本文介绍了试试这个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定我理解你的第一个问题,但要查看 glob"

模块。听起来可能会有所帮助。


以下是如何获取文件夹和文件名


import os


list = os.walk(" C:\ python24 \Tools")

列表中的文件:

folderlist = os.path.split (文件[0])

打印" ****************文件夹***************" ;

打印文件夹列表[1]

print" ========================= ============"

打印

打印" ****************文件*****************"

打印文件[2]

打印" ====== ==============================="

I''m not sure I understand your first question but checkout the " glob "
module. Sounds like it may help.

Here is how you could get the folders and filenames

import os

list = os.walk("C:\python24\Tools")
for file in list:
folderlist = os.path.split(file[0])
print "****************Folder***************"
print folderlist[1]
print "====================================="
print
print "****************Files*****************"
print file[2]
print "====================================="

推荐答案




你在和谁说话?如果你从

原始邮件中引用文本,留下一些原始主题,并回复

原始邮件而不是发布新邮件,这将有所帮助。 />
-

Michael Hoffman



Who are you talking to? It would help if you quoted text from the
original message, left some of the original subject, and replied to the
original message instead of making a new post.
--
Michael Hoffman






r" C:\ python24 \工具"


Artur


-

[Artur M. Piwko:Pipen:AMP29- RIPE:RLU:100918:来自==陷阱! :SIG:230B]

[01:45:21用户最多10684天,13:40,1位用户,平均负载:0.06,0.06,0.06]


未找到备份:A)bort,R)etry,M)是否有心力衰竭?



r"C:\python24\Tools"

Artur

--
[ Artur M. Piwko : Pipen : AMP29-RIPE : RLU:100918 : From == Trap! : SIG:230B ]
[ 01:45:21 user up 10684 days, 13:40, 1 user, load average: 0.06, 0.06, 0.06 ]

Backup not found: A)bort, R)etry, M)assive heart failure?


这篇关于试试这个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 11:44