Why am I getting extra characters while displaying a path in Python 3.X ?
path = 'c:\flag'
>>> path
'c:\x0clag'
Why am I getting extra characters while displaying a path in Python 3.X ?
path = 'c:\flag'
>>> path
'c:\x0clag'
You could take a look at: What are carriage return, linefeed, and form feed?
This is an old escape symbol used in older printers to advance '\f'orward to the next page.
If you don't want this to show up, just add an r
before your text:
Input:
path = r'c:\flag'
path
Output:
'c:\\flag'
Or just put double backslashes instead of one yourself:
path = 'c:\\flag'