Python-based File Write Operation: Difference between revisions
Jump to navigation
Jump to search
(Created page with "A Python-based File Write Operation is a file write operation that is a Python file operation. * <B>Context:</B> ** ... * <B>Example(s):</B> ** <code>...</code> *...") |
m (Text replacement - ". ----" to ". ----") |
||
(6 intermediate revisions by the same user not shown) | |||
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> | ||
Line 9: | Line 9: | ||
** a [[Python Data Conversion Operation]]. | ** a [[Python Data Conversion Operation]]. | ||
* <B>See:</B> [[Python Coding Example]]. | * <B>See:</B> [[Python Coding Example]]. | ||
---- | ---- | ||
---- | ---- | ||
==References == | |||
== References == | |||
* https://docs.python.org/2/tutorial/inputoutput.html | * https://docs.python.org/2/tutorial/inputoutput.html | ||
=== | === 2018 === | ||
* http://en.wikibooks.org/wiki/Python_Programming/Files | * http://en.wikibooks.org/wiki/Python_Programming/Files | ||
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) | |||
---- | ---- | ||
__NOTOC__ | __NOTOC__ | ||
[[Category:Concept]] | [[Category:Concept]] |
Latest revision as of 00:03, 23 September 2021
A Python-based File Write Operation is a file write operation that is a Python file operation.
- Context:
- …
- Example(s):
...
- Counter-Example(s):
- See: Python Coding Example.
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)