빅

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

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

#!/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

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

개발자팁

5,403건

개발과 관련된 유용한 정보를 공유하세요. 질문은 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
Linux 12-05-15 조회 1,951
jQuery 12-05-15 조회 3,503
Linux 12-05-14 조회 1,681
Linux 12-05-14 조회 1,794
Linux 12-05-14 조회 1,935
Linux 12-05-14 조회 2,404
Linux 12-05-14 조회 2,140
jQuery 12-05-14 조회 2,469
기타 12-05-13 조회 2,973
jQuery 12-05-12 조회 3,629
PHP 12-05-11 조회 2,075
jQuery 12-05-11 조회 8,627
Linux 12-05-11 조회 2,919
Linux 12-05-11 조회 1,775
Linux 12-05-11 조회 2,345
Linux 12-05-11 조회 2,242
Linux 12-05-11 조회 2,524
Linux 12-05-11 조회 1,694
JavaScript 12-05-10 조회 3,166
Linux 12-05-10 조회 3,462
Linux 12-05-10 조회 1,888
Linux 12-05-10 조회 1,979
Linux 12-05-10 조회 2,368
Linux 12-05-10 조회 4,751
Linux 12-05-10 조회 1,950
Linux 12-05-10 조회 2,132
Linux
[Linux]
12-05-10 조회 2,024
Linux 12-05-10 조회 1,861
Linux 12-05-10 조회 2,355
Linux 12-05-10 조회 3,115