Skip to content

Instantly share code, notes, and snippets.

@ChengLuFred
Last active June 25, 2020 19:59
Show Gist options
  • Save ChengLuFred/a8b54c363f64938d17712983244baac7 to your computer and use it in GitHub Desktop.
Save ChengLuFred/a8b54c363f64938d17712983244baac7 to your computer and use it in GitHub Desktop.
[Path Management] #Python

check path validation

if not os.path.exists(OUTPUT_FILE_PATH):
            os.makedirs(OUTPUT_FILE_PATH)
            if verbose:
                print('Path: {0} created'.format(OUTPUT_FILE_PATH))
  • path containing number need double slash \\ before number
>>>'I:\Textual Analysis Data\10-X from LM\*.zip' # doesn't work
>>>'I:\Textual Analysis Data\\10-X from LM\*.zip' # work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment