08-Reading_a_single_line_from_file.py


Sign up Free. Don't forget to check out our challenges, lessons, solve and learn series and more ...


Code Snippet

f=open("teacherbook.txt","r") #opens file with the name of teacherbook.txt
print(f.readline()) #rather than characters, this will read the entire first line held in the file

                    

Try it yourself