#-*- coding:utf-8 -*-
import os,sys,string
output = open('output.txt', 'w')
for root,dirs,files in os.walk('.'):
for f in files:
print f
output.write(f + '\n')
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
C:\Documents and Settings\Administrator\桌面>python
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print '\xd0\xc2\xbd\xa8\xce\xc4\xb1\xbe\xce\xc4\xb5\xb5'
新建文本文档