|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html>
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
<title>Tasks of the Contingent Librarian</title>
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="tasks.css">
|
|
|
|
|
<script src="tasks.js"></script>
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
|
|
<div class="cardback"><DOCUMENT_FRAGMENT><div class="mw-parser-output"><div class="thumb tright"><div class="thumbinner" style="width:152px;"><a class="image" href="File:RFID_tag.jpeg.html"><img alt="" class="thumbimage" decoding="async" height="106" src="/mw-mediadesign/images/thumb/e/ee/RFID_tag.jpeg/150px-RFID_tag.jpeg" srcset="/mw-mediadesign/images/thumb/e/ee/RFID_tag.jpeg/225px-RFID_tag.jpeg 1.5x, /mw-mediadesign/images/thumb/e/ee/RFID_tag.jpeg/300px-RFID_tag.jpeg 2x" width="150"></a> <div class="thumbcaption"><div class="magnify"><a class="internal" href="File:RFID_tag.jpeg.html" title="Enlarge"></a></div>Illustration of an RFID tag</div></div></div>
|
|
|
|
|
<h1><span class="mw-headline" id="Reading_files">Reading files</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/mw-mediadesign/index.php?title=User:Simon/Trim4/tools/Python_read_file&action=edit&section=T-1" title="Edit section: ">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
|
|
|
|
|
<p>For Python to read a file:
|
|
|
|
|
</p>
|
|
|
|
|
<pre>with open('README.md', 'r') as txt:
|
|
|
|
|
|
|
|
|
|
txt_content = txt.read()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print(txt_content)
|
|
|
|
|
</pre>
|
|
|
|
|
<!--
|
|
|
|
|
NewPP limit report
|
|
|
|
|
Cached time: 20200611171534
|
|
|
|
|
Cache expiry: 86400
|
|
|
|
|
Dynamic content: false
|
|
|
|
|
CPU time usage: 0.012 seconds
|
|
|
|
|
Real time usage: 0.013 seconds
|
|
|
|
|
Preprocessor visited node count: 7/1000000
|
|
|
|
|
Preprocessor generated node count: 26/1000000
|
|
|
|
|
Post‐expand include size: 103/2097152 bytes
|
|
|
|
|
Template argument size: 0/2097152 bytes
|
|
|
|
|
Highest expansion depth: 2/40
|
|
|
|
|
Expensive parser function count: 0/100
|
|
|
|
|
Unstrip recursion depth: 0/20
|
|
|
|
|
Unstrip post‐expand size: 89/5000000 bytes
|
|
|
|
|
-->
|
|
|
|
|
<!--
|
|
|
|
|
Transclusion expansion time report (%,ms,calls,template)
|
|
|
|
|
100.00% 3.837 1 User:Simon/Trim4/tools/Python_read_file
|
|
|
|
|
100.00% 3.837 1 -total
|
|
|
|
|
-->
|
|
|
|
|
|
|
|
|
|
<!-- Saved in parser cache with key wdka_mw_mediadesign-mw_:pcache:idhash:31750-0!canonical and timestamp 20200611171534 and revision id 174176
|
|
|
|
|
-->
|
|
|
|
|
</div></DOCUMENT_FRAGMENT></div>
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|