python脚本

1. 查找文件夹下所有的文件,并将文件的全路径打印出来

#-*-coding:utf-8-*-
import os

def print_out(str):
    print str.decode("gbk").encode("utf-8")

def get_in(str):
    return str.decode("utf-8").encode("gbk")

def find_file(file_name):
    file_name=get_in(file_name)
    for root, dirs, files in os.walk(file_name):
        for file_temp in files:
            print_out(root+file_temp)
find_file('E:\电子书整理\')

参考:

原文地址:https://www.cnblogs.com/yanliang12138/p/10160102.html