Thursday, 16 February 2017

Python Tutorial - 23 (read and write files)



Code used -

writing = open ('test.txt', 'w')
writing.write ('welcome to hacking monks\n')
writing.write ('xxxxxxx')
writing.close()

reading = open ('test.txt', 'r')
test = reading.read()
print(test)

reading.close()




Other posts -













No comments:

Post a Comment