1.列表 # Filename: using_list.py # This is my shopping list shoplist=["apple", "mango", "carrot", "banana"] print ("I have", len(shoplist), "items to purchase.") print ("These items are:"
python遍历一个目录,输出所有文件名 python os模块 os import os def GetFileList(dir, fileList): newDir = dir if os.path.isfile(dir): fileList.append(dir.encode('gbk')) elif os.path.isdir(dir): for s in os.listdir(dir): #如果需要忽略某些文件夹,使用以下代码 #if s == "xxx":