Answers for "with open file to read"

4

python open and read file with

with open('pagehead.section.htm','r') as f:
    output = f.read()
Posted by: Guest on May-15-2020
0

open and read a file in python

my_file = open("C:\Users\Python\file.txt", "r")
#Give the path accurately and use \
text = my_file.read()
print(text)

#Output: The text in file.txt will be printed
Posted by: Guest on January-06-2022

Python Answers by Framework

Browse Popular Code Answers by Language