with open('Identified Atoms', 'w') as fo:
for num, i in enumerate(iden_interfaceAtomA_B):
print(f' >>> {num}')
for j in iden_interfaceAtomC_D:
fo.write( str(i[0]) )
fo.write( str(i[1]) )
fo.write('\n')
There is a code that uses nested for loop in the code above, but it takes too long as the wearable object (?) gets bigger. I want to make a code more pythonic and efficiently, so what should I do?
python
iden_interfaceAtomC_D_len = len(iden_interfaceAtomC_D)
with open('Identified Atoms', 'w') as fo:
for num, i in enumerate(iden_interfaceAtomA_B):
print(f' >>> {num}')
#for j in iden_interfaceAtomC_D:
# # fo.write( str(i[0]) )
# # fo.write( str(i[1]) )
# # fo.write('\n')
fo.write( (str(i[0])+str(i[1])+'\n') * iden_interfaceAtomC_D_len )
© 2024 OneMinuteCode. All rights reserved.