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 281 views
281 views asked Jul 8, 2020 by avibootz
1 answer 274 views
2 answers 425 views
1 answer 265 views
2 answers 347 views
...