python character set conversion by the compiler

41 Views Asked by At
C:\c>python -m pydoc wordspyth^A.split

no python documentation found for 'wordspyth\x01.split'

I understand that python documentation doesn't exist, but why does ^A convert to \x01?

2

There are 2 best solutions below

0
On

Ctrl+A is a control character with value 1, those are echoed hexidecimal by default. As they might break your prompt/terminal and/or would be illegible.

That pydoc doesn't know about the non-standard function wordspyth doesn't mean there is no documentation

0
On

Like Anthon said , ctrl + A is a non-printable character , when you add that to a string in python and the string is printed out, python internally converts many such non-printable characters to printable unicode format.

This was done in Python 3000 through http://legacy.python.org/dev/peps/pep-3138/