빅

[python]os.path.exists() 파일 존재 체크하기

· 2012-05-15 (화) 16:12:17 · 1586

#!/usr/bin/python

import os

if not os.path.exists("./test.txt"):
        print "test.txt file not exist"

if os.path.exists("./test.txt"):
        print "test.text file exist"

root@byoungguk-desktop:~# ./existtest.py 
test.txt file not exist
root@byoungguk-desktop:~# touch test.txt
root@byoungguk-desktop:~# ./existtest.py 
test.text file exist

 
댓글을 작성하시려면 로그인이 필요합니다.

팁게시판

6,077건

디자인과 관련된 유용한 정보를 공유하세요. 질문은 상단의 QA에서 해주시기 바랍니다.

+
제목 글쓴이 날짜 조회
12-05-16 조회 1,013
12-05-16 조회 896
12-05-16 조회 2,203
12-05-16 조회 809
12-05-16 조회 831
12-05-16 조회 1,124
12-05-16 조회 859
12-05-16 조회 716
12-05-16 조회 1,090
12-05-16 조회 1,222
12-05-15 조회 1,257
12-05-15 조회 2,007
12-05-15 조회 1,169
12-05-15 조회 750
12-05-15 조회 974
12-05-15 조회 1,587
12-05-15 조회 1,063
12-05-15 조회 700
12-05-15 조회 1,618
12-05-14 조회 716
12-05-14 조회 717
12-05-14 조회 627
12-05-14 조회 940
12-05-14 조회 701
12-05-14 조회 1,149