How to read the content of a text file in Python

1 Answer

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

print(f.read())


'''
run:
 
C++
VB.NET
C#
Java
PHP
Python

'''

 



answered Nov 26, 2018 by avibootz

Related questions

2 answers 481 views
1 answer 283 views
283 views asked Jul 8, 2020 by avibootz
1 answer 275 views
2 answers 425 views
1 answer 266 views
2 answers 349 views
...