# --- picknames.py ---
import os
filenames = os.listdir(os.getcwd())
for name in filenames:
print
str(name)
filenames[filenames.index(name)]=name[:-3]
out=open('names.txt','w')
for name in
filenames:
out.write(name+'\n')
out.close()
一个python学起来还真不容啊,习惯了php的语法。突然发现不会写程序了。
error1:indentationError:expected an indented block;
正解:缩进的问题。按照提示的行数进行tab缩进
import os
filenames = os.listdir(os.getcwd())
for name in filenames:
一个python学起来还真不容啊,习惯了php的语法。突然发现不会写程序了。
error1:indentationError:expected an indented block;
正解:缩进的问题。按照提示的行数进行tab缩进