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 228 views
1 answer 202 views
1 answer 197 views
1 answer 169 views
169 views asked Jul 7, 2020 by avibootz
1 answer 248 views
1 answer 219 views
1 answer 172 views
...