Created
March 24, 2011 13:10
-
-
Save r-plus/885026 to your computer and use it in GitHub Desktop.
ディレクトリ配下に山のようにファイルがある際に、必要なファイルがあるかどうかを確認する。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/env python | |
#coding: utf-8 | |
import os | |
findList = u""" | |
ここにファイル名を改行区切りで記述 | |
""" | |
list = os.listdir(u'/home/r_plus') # WindowsのPATHは要バックスラッシュ u'C:\\User\\r_plus' | |
line = findList.strip().splitlines() | |
for name in line: | |
bool = name.encode('utf-8') in list # Mac:utf-8 Windows(XPで確認):shift_jis Linux:? | |
outputText = name + ',' + unicode(bool) | |
print (outputText) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment