Python-based File Write Operation: Difference between revisions

From GM-RKB
Jump to navigation Jump to search
m (Text replacement - "==References " to "== References ")
m (Text replacement - "** ..." to "** …")
Line 1: Line 1:
A [[Python-based File Write Operation]] is a [[file write operation]] that is a [[Python file operation]].
A [[Python-based File Write Operation]] is a [[file write operation]] that is a [[Python file operation]].
* <B>Context:</B>
* <B>Context:</B>
** ...
**
* <B>Example(s):</B>
* <B>Example(s):</B>
** <code>...</code>
** <code>...</code>

Revision as of 14:31, 29 April 2020

A Python-based File Write Operation is a file write operation that is a Python file operation.



References

2018

outputFileText = "Here's some text to save in a file"
open("testit.txt", "w").write(outputFileText)

Append to a file requires the second parameter of open() to be "a" (from append):

outputFileText = "Here's some text to add to the existing file."
open("testit.txt", "a").write(outputFileText)