How to append text to text file in Python

2 Answers

0 votes
with open('info.txt', 'a') as f:
    f.write("javascript" + "\n") 
    f.write("c#" + "\n") 
	
	

'''
run:

python
c++
javascript
c#

'''

 



answered Jun 22, 2020 by avibootz
0 votes
f = open('info.txt', 'a')

f.write("javascript" + "\n")
f.write("c#" + "\n")

f.close()



'''
run:

python
c++
javascript
c#

'''

 



answered Jun 22, 2020 by avibootz

Related questions

2 answers 224 views
1 answer 199 views
1 answer 193 views
1 answer 166 views
166 views asked Jul 7, 2020 by avibootz
1 answer 240 views
1 answer 215 views
1 answer 166 views
...