User:Simon/Trim4/tools/Python read file: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
No edit summary
Line 10: Line 10:


print(txt_content)</nowiki>
print(txt_content)</nowiki>
[[Category:Tasks of the Contingent Librarian|machine reading]]

Revision as of 10:46, 26 May 2020

Reading files

For Python to read a file:

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

    txt_content = txt.read() 


print(txt_content)