I have a list containing directories: ("..\b\c.txt", "..\b\d.txt")
.
I was planning to use .split()
method to have another list of the directory components separated by "\"
, but I'm not having success mostly due to "\"
usage. Thus, the final result will be something like this ("a", "b, "c.txt")
...
I do understand \
being a escape character and the difficulties reported by this link, but I'm not understanding if it's possible to convert the entire list to raw string. Can anyone help?
files = ('..\..\data\User\level1\level2\sun.png','..\..\data\User\level1\level2\description.txt')
I was testing something like this:
str = files[0].split("\")
Desired output: a list containing:
('data', 'User', 'level1', 'level2', 'sun.jpg')