摘自:http://www.jb51.net/article/60641.htm

 

#!/usr/bin/env python
import glob

import os

os.chdir(“./”)

for file in glob.glob(“*.py”):

print file
print “#######Another One##########”
for file in os.listdir(“./”):

if file.endswith(“.py”):

print file
print “#######Another Two##########”

for root, dirs, files in os.walk(“./”):

for file in files:

if file.endswith(“.py”):

print os.path.join(root, file)
print “#######Another Three##########”
os.chdir(“./”)

filename_arr={}

i=0

for files in glob.glob(“*.py”):

filename_arr[i] = files

i += 1
for key, value in filename_arr.items():

print key, value

 

相关文章:

  • 2022-12-23
  • 2021-06-16
  • 2022-12-23
  • 2021-08-09
  • 2022-12-23
  • 2022-12-23
  • 2021-07-20
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-02
相关资源
相似解决方案