繁体   English   中英

如何检查python中的文件夹中是否存在.dat文件,如果存在,如何将其与关联的csv匹配?

[英]How to check if a .dat file is present in a folder in python and if it is there,how to match it with associated csv?

我有一个文件夹,每当上传.csv文件时,我都会在其中获取.dat文件。

所以,我想检查一个.dat文件是否存在于特定位置,如果它存在,那么我才想使用 python 和 boto3 将我的文件上传到 s3。

有人可以帮我做到这一点吗?

请尝试以下操作:

import os

path_to_your_file = ''
if os.path.isfile(path_to_your_file):
    print('File exists')
else:
    print("File doesn't exist")

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM