我是巨蟒的新手。
我试图写一个程序,它将从.txt文件中读取文件。
(这意味着我有一个“filenames.txt”文件,并且该文件中有文件名及其路径)
如何从该.txt文件中读取这些文件名并获取文件的创建日期?
下面是我提出的代码:
import sys, os
import pathlib
# list of filenames with their paths separated by comma
file_list = []
# input file name which contains list of files separated by \n
with open ('filenames.txt' , 'r+' ) as f :
list_file = f.readlines().splitlines()
input_list = file_list + list_file
def file_check(input_list):
if input_list is none:
print ("input_list is null")
print (input_list)
事先谢谢。