Why can't I type "\ 05" or "\ 07" etc.?

When I try to run:

print "\05"

Nothing is printed. If I change 5after \0to another number, something strange will happen. Why is this?

+4
source share
4 answers

A backslash is an escape sequence for adding literals to a string by ordinal value. This means that you take the ASCII character code and literally paste it into your string. The reason you do this is because some characters are not allowed in the source code.

\05, [enquiry], . , python , .

, , , .

ascii character code table ( Wikimedia commons, ).

, \05, bashslash ( , , , ). , , bashslash (, ). , , , , :

print "\\05"

\05

+3

ASCII 0x20 0x7E .

ASCII, . , 0x07, a.k.a, BEL , - .

+3

This is not a valid (printed) ASCII character. Do you mean that you literally want to type "\ 05"? If so, just avoid the backslash with another backslash, for example:

print "\\05"
+1
source

Try it. You need an extra "\" to exit.

 print "\\05"
+1
source

Source: https://habr.com/ru/post/1622402/


All Articles