Python的杂七杂八 import osprint os.listdir('.')files = [f for f in os.listdir('.') if re.match("*.jpg", f) ]
?
2. 读取文件自动关闭
with open(filename) as file: for line in file: print line