This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0 1 | |
C -1.20326 2.85220 0.25234 | |
H -0.37439 3.51897 0.03795 | |
C -1.82835 2.05722 -0.84623 | |
O -1.62242 2.75455 1.39418 | |
H -1.31730 2.27626 -1.80702 | |
H -2.90224 2.32334 -0.93775 | |
H -1.73531 0.97336 -0.62482 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shutil | |
with open('/home/user/acetylene.xyz','r') as fsrc: | |
with open('/home/user/acetylene-copy.xyz','w') as fdst: | |
shutil.copyfileobj(fsrc, fdst) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with open('/home/user/acetylene.xyz','r') as a_file: | |
print(a_file.read()) | |
if a_file.closed is True: | |
print("You won't see this") | |
if a_file.closed is True: | |
print ("file is closed now!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
f = open('/home/user/acetylene.xyz') | |
while True: | |
line = f.readline() | |
if len(line) == 0: | |
break | |
print(line, end=' ') | |
finally: | |
f.close() | |
print('file is closed now!') |
NewerOlder