No need to import anything.
Just use regular syntax and it will open the file for reading and then close it.
with open("/etc/hostname","r") as f: print f.read()
or
with open("/etc/hosts","r") as f: x = f.read().splitlines()
which gives you an x ββarray containing strings that can be printed like this:
for i in range(len(x)): print x[i]
These single line lines are very obvious.
SDsolar Sep 10 '17 at 5:21 on 2017-09-10 05:21
source share