Answers for "readlines to string python"

13

python read file to variable

with open('data.txt', 'r') as file:
    data = file.read().replace('\n', '')
Posted by: Guest on February-27-2020
7

readlines from file python

f = open("file.txt", 'r')
print(f.readlines())  # array of file lines
Posted by: Guest on May-29-2020
1

readlines()

f = open("demofile.txt", "r")
print(f.readlines())
Posted by: Guest on July-02-2021

Python Answers by Framework

Browse Popular Code Answers by Language