python实现文件夹里有多少文件
#方法1 输出是0 a=os.popen("ls|wc -w") a=a.read() print(a) # #方法2 输出多1 ,因此减1 # res_count=len(os.listdir(result_path))-1 # print("文件总数:{}".format(res_count)) # # #打印文件名字 for name in os.listdir(result_path): print(os.path.join(result_path, name)) # # #获取输入文件的长度 # retry_count = 0 # while retry_count < 3: # retry_count = retry_count + 1 # if res_count != len(input_data): # run_remote_baiduapi(query_platform) # if res_count == len(input_data): # break