Answers for "python append to file name"

30

python append to file

with open(filename, "a+") as f:
  f.write('Hello World')
Posted by: Guest on March-30-2020
0

append file to list python

list=[]
f = open('file.txt','r')

for line in f:
    list.append(line.rstrip())  #if you want the \n replace rstrip by strip
Posted by: Guest on November-10-2021

Python Answers by Framework

Browse Popular Code Answers by Language