How to read one line of a text file in Python

1 Answer

0 votes
f = open("d:\data.txt", "rt")  # OR f = open("d:\data.txt")

print(f.readline())


'''
run:
 
C++

'''

 



answered Nov 26, 2018 by avibootz

Related questions

1 answer 322 views
1 answer 305 views
3 answers 453 views
2 answers 397 views
1 answer 305 views
2 answers 362 views
1 answer 323 views
...