1with open ("data.txt", "r") as myfile:
2 data = myfile.read().splitlines()
3
1file = open(“testfile.txt”,”w”)
2
3file.write(“Hello World”)
4file.write(“This is our new text file”)
5file.write(“and this is another line.”)
6file.write(“Why? Because we can.”)
7
8file.close()
1file = '/home/text/chapter001.txt'
2f=open(file,'r')
3data = f.read()
4print('data =',data)
1fin = open("NAME.txt", 'r')
2body = fin.read().split("\n")
3line = fin.readline().strip()