User:Simon/Trim4/tools/Python read file: Difference between revisions
< User:Simon | Trim4/tools
(Created page with "For Python to read a file: <code> with open('README.md', 'r') as txt: txt_content = txt.read() print(txt_content)</code>") |
No edit summary |
||
Line 1: | Line 1: | ||
=Reading files= | |||
For Python to read a file: | For Python to read a file: | ||
< | <nowiki> | ||
with open('README.md', 'r') as txt: | with open('README.md', 'r') as txt: | ||
Line 7: | Line 9: | ||
print(txt_content)</ | print(txt_content)</nowiki> |
Revision as of 17:27, 15 November 2019
Reading files
For Python to read a file:
with open('README.md', 'r') as txt: txt_content = txt.read() print(txt_content)