打印目录结构
scturtle
posted @ 2011年8月22日 13:45
in python
, 1703 阅读
# coding: utf-8 import os,sys,codecs lc=sys.getfilesystemencoding() sys.stdout=codecs.lookup(lc)[-1](sys.stdout) def walkdir(d,prefix=u''): l=os.listdir(d) last=len(l)-1 prefix+=u' │' for i,f in enumerate(l): if i!=last: print prefix+u'─', else: print prefix[:-1]+u'└─', prefix=prefix[:-1]+u' ' print f.decode(lc) p=os.path.join(d,f) if os.path.isdir(p): walkdir(p,prefix) if __name__ == '__main__': d=os.path.abspath('.') print os.path.basename(d).decode(lc) walkdir(d)
output:
ComicShelf │─ dirtree.py │─ zipMyComic.py │─ 死神 │ │─ 死神_第460话 │ │ │─ 001.jpg │ │ │─ 002.jpg │ │ │─ 003.jpg │ │ └─ 018.jpg │ └─ 死神_第460话.zip │─ 海贼王 │ │─ 海贼王[635]悍破云霄 │ │ │─ 001.jpg │ │ │─ 002.jpg │ │ │─ 003.jpg │ │ └─ 017.jpg │ └─ 海贼王[635]悍破云霄.zip └─ 火影忍者 │─ 火影忍者[551]阻止长门 │ │─ 001.jpg │ │─ 002.jpg │ │─ 003.jpg │ └─ 015.jpg └─ 火影忍者[551]阻止长门.zip
2022年9月21日 20:52
One of the fundamental courses that is covered as a component of General Science for sixth-standard pupils is physics. The majority of contemporary technology, as well as the devices and equipment utilised in scientific, NCERT Physics Question Paper Class 6 technical, and medical research and development, are based on physics. Physics-based technology is dominant in the manufacturing industry. The majority of candidates enrolled in upper primary believe this topic to be among the most difficult.