摘要: 运行后一堆空白行>>> fname=input('Enter filename:')Enter filename:hongding>>> try: fobj=open(fname,'r')except(IOError,e): print('***file open error:',e)e... 阅读全文
posted @ 2015-07-25 16:22 hhj187 阅读(111) 评论(0) 推荐(0) 编辑
摘要: >>> import os>>> ls = os.linesep>>> # get filename>>> while True: fname = input('Enter file name: ') if os.path.exists(fname): print("***... 阅读全文
posted @ 2015-07-25 13:08 hhj187 阅读(290) 评论(0) 推荐(0) 编辑
摘要: 来源 http://www.cppblog.com/snowhill/articles/200826.htmlOS相关import os可以用help(os); dir(os)查看os.sep 可以取代操作系统特定的路径分割符。os.name字符串指示你正在使用的平台。比如对于Windows,它是'... 阅读全文
posted @ 2015-07-25 12:32 hhj187 阅读(929) 评论(0) 推荐(0) 编辑