Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python write text file

text = '''Some random data
'''

# write to data.txt
with open('data.txt', 'w') as f:
   f.write(text)

# append to data.txt
with open('data.txt', 'a') as f:
   f.write(text)
Source by codefreelance.net #
 
PREVIOUS NEXT
Tagged: #python #write #text #file
ADD COMMENT
Topic
Name
7+5 =