iterate through list of paths (short script)(Windows)(Python)(Lists)

Job ID: 32496084

Budget: $10 – $30 USD

Hi,

My problem is that Python on Windows adds additional "\" to the file path, when it reads it from a list, and it cannot read the file.
I need Python to read all paths from list with single "\" not double "\\"

I have a list of paths:

path_list = [D:\TEST\text1.txt, D:\TEST\text2.txt]
path_list2 = [D:\\TEST\\text1.txt, D:\\TEST\\text2.txt]

When I try to open each file, I get the same error for both path_list and path_list2:
FileNotFoundError: [Errno 2] No such file or directory: 'D:\\TEST\\text1.txt'

Python adds "\\" to all paths, and at the same time it cannot open the file. I need a solution.
Thanks
Related categories: Python Windows Desktop Software Architecture