by
2,880 20
0
6
2,019
0
Top 1% !
Popular
Famous
Specified
Debate
OpenSource
Popularity: 9937th place
Created
Modified Jul 1, 2013

Published on:

No tags for this snippet yet.
LicenseMIT_X11
MacOS Version10.7
OSMac OS X

Read in a file

Reads in a file given the full file path.
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/1665/Read-in-a-file?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
def read_file(file_path): f = open(file_path, 'r+') lines = f.read() f.close() return lines
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus