我是一个相当新的文件和目前的写作方法,我可以通过文件.pom路径并检查.jar文件是否存在于同一路径中。你知道吗
def get_file_type(self, file_path):
return pathlib.Path(file_path).suffix
def check_if_file_exists(self, pom_file_path, extension):
pom_file_extract_file = str(pom_file_path).rpartition("/")
pom_file_extract_filename = str(pom_file_extract_file [-1]).rpartition("-")
if pom_file_extract_filename ... # stuck
....
for file in files:
f = os.path.join(zip_path, file)
f_fixed = "." + f.replace("\\", "/")
if self.get_file_type(f_fixed) == ".pom":
pom_paths = (root + "/" + file).replace("\\", "/")
print(pom_paths)
# if self.check_if_file_exists(pom_paths, ".jar") == True:
# Do stuff...
我应该通过pom的dir吗?你知道吗
在pathlib中找到了
is_file()
方法,使用该方法可以帮助我解决问题:编辑
尽管如此,我还是使用这个方法来查找
-javadoc.jar
文件。你知道吗^{} 有几个方便的函数:
你的职能是:
相关问题 更多 >
编程相关推荐