看板 [ Python ]
討論串[問題] 判斷檔案存不存在
共 5 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓1(1推 0噓 1→)留言2則,0人參與, 最新作者jeffreychen時間17年前 (2008/06/19 18:52), 編輯資訊
0
0
0
內容預覽:
請問一下. 我想判斷aaa檔名的檔案存不存在. 在python要如何寫呢. --. 發信站: 批踢踢實業坊(ptt.cc). ◆ From: 61.57.149.215.

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者kenduest.時間17年前 (2008/07/22 02:01), 編輯資訊
0
0
1
內容預覽:
引述《jeffreychen.bbs@ptt.cc》之銘言:. > 請問一下. > 我想判斷aaa檔名的檔案存不存在. > 在python要如何寫呢. import os.path. if os.path.exists("aaa") :. print "exist". else:. print
(還有65個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者qrtt1.時間17年前 (2008/07/22 10:01), 編輯資訊
1
0
1
內容預覽:
> 引述《jeffreychen.bbs@ptt.cc》之銘言:. > > 請問一下. > > 我想判斷aaa檔名的檔案存不存在. > > 在python要如何寫呢. > import os.path. > if os.path.exists("aaa") :. > print "exist".
(還有257個字)

推噓1(1推 0噓 2→)留言3則,0人參與, 最新作者yjc1 (..........)時間17年前 (2008/07/22 19:30), 編輯資訊
1
0
0
內容預覽:
引述《qrtt1.bbs@bbs.cs.nctu.edu.tw (null)》之銘言:. ............... 這樣倒不如直接寫. print ('not exist', 'exists')[os.path.exists("aaa")]. --. 在 python 裡寫 obscue

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者yungyuc (酷狗喵千代)時間17年前 (2008/07/23 03:24), 編輯資訊
0
0
0
內容預覽:
print "exists" if os.path.exists(f) else "not exist". 都什麼年代了還在用 logic operator? :p. Python 3.0:. print("exists" if os.path.exists(f) else "not exist")
首頁
上一頁
1
下一頁
尾頁