I am trying to access folders in a sharedrive but the numbers placed in front of the folder names are causing issues. I have no idea why the numbers in front of the two folders 02_COLLECTION_VEHICLES and 07_GIS_LAYERS are present. I created the GIS_LAYERS folder but I didn't name it along with the 07_. At any rate, my program can access the sharedrive folders just fine that do not have the numbers and underscores in their name. So what can I do to access these folders? I was thinking of using regular expressions but im not sure how to use them in this case.
Here is the code for accessing and retrieving the file:
def readerOut():
import os
import re
os.chdir(\
('S:\PAVE_MANAGEMENT\AUTOMATED_DISTRESS_SURVEYS\02_COLLECTION_VEHICLES\07_GIS_LAYERS')
reader = open('2015_FILES_COMBINED.CSV')
yield reader
When I run this code I get a WindowsError: [Error 3] and it says that it cannot find that specified file path.
Would something like this work if it was in the function?:
re.search('^[0-9]\\d*_COLLECTION_VEHICLES\^[0-9]\d*_GIS_LAYERS')
Use multiple back slashes instead of single back slash and then give a try