标签:
第一种方法
#encoding=utf-8 file = open("./man_data.txt","r") try: print file.read() finally: file.close()
第二种方法
#encoding=utf-8 try: with open(‘./man_data.txt‘,‘r‘) as man_file: data=man_file.read() print data except IOError as err: print(‘file error:‘+str(err))
标签:
原文地址:http://www.cnblogs.com/gide/p/5525251.html