In [ ]:
import os
f = open("temp.txt", 'w')
f.write("ala ma kota \n ala ma kota\n a")
f.close()
f = open("temp.txt", 'r')
for line in f:
print(line)
f.close()
os.remove("temp.txt")
In [ ]:
import os
with open("temp.txt", 'w') as f:
f.write("ala ma kota \n ala ma kota\n a")
with open("temp.txt", 'r') as f:
print(f.readlines())
os.remove("temp.txt")
In [ ]:
import os
with open("temp.txt", 'a') as f:
pass
os.remove("temp.txt")
In [ ]:
import os
def touch(path):
with open(path, 'a') as f:
os.utime(path, None)
path = "temp.txt"
touch(path)
os.remove(path)