User:Simon/Trim4/tools/Python read file

From XPUB & Lens-Based wiki
< User:Simon‎ | Trim4/tools
Revision as of 16:29, 14 November 2019 by Simon (talk | contribs) (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>")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

For Python to read a file:

with open('README.md', 'r') as txt:

   txt_content = txt.read() 


print(txt_content)