Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python Print to File

# Print to the text file
file = open('log.txt', 'w')
print('This is a sample print statement', file = file)
print('Hello World', file = file)

file.close()
Source by itsmycode.com #
 
PREVIOUS NEXT
Tagged: #Python #Print #File
ADD COMMENT
Topic
Name
1+7 =