1myfile = open("demo.txt", "r")
2myline = myfile.readline()
3while myline:
4 print(myline)
5 myline = myfile.readline()
6myfile.close()
7
1myFile = open("test.txt,"r")
2print(myFile.readline(0))# print the first line of the text file
3print(myFile.readline(1))# print the second line of the text file
4print(myFile.readline(2))# print the tird line of the text file
5# ect..
6# you might need to use MyFile.seek(0) after reading
1
2 f = open("C:\\Users\\Andreea Pantus\\Desktop\\An 2, Semestrul 2\\Inteligenta artificiala, machine learning\\ai-unibuc-24-22-2021\\train.txt", "r")
3print(f.readline())