In the following code, dirpath
starts from current directory something like ./x/y
. Then I want to add fullname of current directory to it, but it results /root/./x/y/file.txt
, but I want /root/x/y/file.txt
def get_files(self):
cur_path = Path().resolve()
print("cur_path:", cur_path)
for dirpath, dirnames, filenames in os.walk("."):
for filename in [f for f in filenames if "scored_" in f]:
dfname = os.path.join(cur_path, dirpath, filename)
tag = dfname.replace("/","_")
print("dfname:", dfname)
self.dflist[tag.strip()] = dfname.strip()