2006年04月24日 星期一 18:56
请问大家: 怎么判断文件是否存在? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060424/75ac6bd6/attachment.html
2006年04月24日 星期一 20:01
On 4/24/06, huang yipeng <yipenghuang at gmail.com> wrote: > > 请问大家: > 怎么判断文件是否存在? > import os os.path.exists("the_path_to_the_file") _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > -- Best Regards Shixin Zeng -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060424/5f140530/attachment.html
2006年04月24日 星期一 20:09
On 4/24/06, Shixin Zeng <zeng.shixin at gmail.com> wrote: > > > > On 4/24/06, huang yipeng <yipenghuang at gmail.com> wrote: > > > > 请问大家: > > 怎么判断文件是否存在? > > > > import os > os.path.exists("the_path_to_the_file") > 或者: os.access("the_path_to_the_file", os.F_OK) 再或者: try: os.stat("the_path_to_the_file") except: print "doesn't exist" else: print "exist" _______________________________________________ > > python-chinese > > Post: send python-chinese at lists.python.cn > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > -- > Best Regards > > Shixin Zeng > -- Best Regards Shixin Zeng -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060424/dff66aa0/attachment.htm
2006年04月25日 星期二 09:19
好好看看os模块,里面有文件操作的各种方法。 Qutr,qutianrang at gmail.com 2006-4-25 ----- Original Message ----- From: huang yipeng To: python-chinese Sent: 2006-04-24, 18:56:18 Subject: [python-chinese] 怎么判断文件是否存在? 请问大家: 怎么判断文件是否存在? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060425/9f196794/attachment.html
Zeuux © 2025
京ICP备05028076号