I have the following function to read files from a directory.
def collect_doc(root, verboose = True):
filepaths = [os.path.join(root, i) for i in os.listdir(root)]
if verboose:
print(f"filepaths={filepaths}")
return filepaths
It works but I get the following:
filepaths=['C:/Users/Admin/Downloads/corpus\\0.txt', 'C:/Users/Admin/Downloads/corpus\\1.txt']
I am looking to get the same but as following:
filepaths=['C:/Users/Admin/Downloads/corpus/0.txt', 'C:/Users/Admin/Downloads/corpus/1.txt']