读文件:
fname = raw_input("Please input the file path:")
print fname
try:
fobj = open(fname,"r")
except IOError,e:
print "The file '%s' is read error! \n"%fname,e
else:
for eachLine in fobj:
print eachLine,
fobj.close()
读文件:
fname = raw_input("Please input the file path:")
print fname
try:
fobj = open(fname,"r")
except IOError,e:
print "The file '%s' is read error! \n"%fname,e
else:
for eachLine in fobj:
print eachLine,
fobj.close()