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 216 views
1 answer 214 views
3 answers 299 views
2 answers 252 views
1 answer 181 views
2 answers 230 views
1 answer 207 views
...