I have a list of paths in a .txt file and I'm trying to parse out one folder in the path name using python.
9999\New_folder\A\23818\files\
9999\New_folder\A\18283_HO\files\
...
What I'm interested in doing is pulling the string between 9999\New_folder\A\ and \files\ so that I end up with:
23818
18283_HO
Any help would be appreciated!
EDIT: Thanks a lot everyone! Came up with the following code with your input.
input_text = open('C:\\Python\\textintolist\\Document1.txt', 'r')
output_text = open('output.txt', 'w')
paths =[]
for line in input_text:
paths.append(line)
for path in paths:
output_text.write(str(path.split('\\')[3])+"\n")