(→Python) |
(→Python) |
||
Line 964:
* File operations
Using Open:
f = open('/etc/passwd')
f.read(5)
f.close()
Using With Open(better, auto closes the file):
with open('/etc/passwd') as f:
for line in f:
print(line)
* Class
|