operating system - Escape \n in pathname to use os python module -
i have path of form input_path=c:\users\ngv\workspace\filename1.
i using dir,file = os.path.split(input_path).
this prints: `dir= c:\users
gv\workspace` treating \n of \ngv newline
and file = filename1
. how fix this? cannot seem find way escape \n. tried input_path=input_path.replace('\n','\\n')
, input_path.replace('\\n','\\\n')
failed results.
please note using exec() in python. , during exec() invoke file path name changes.
Comments
Post a Comment