updated contents from Atlas repo
This commit is contained in:
22
strings-bytes/strings-bytes-test.txt
Normal file
22
strings-bytes/strings-bytes-test.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
>>> s = 'naïve' <1>
|
||||
>>> b = b'naïve' <2>
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
SyntaxError: bytes can only contain ASCII literal characters.
|
||||
>>> b = bytes('naïve', 'iso8859-1') <3>
|
||||
>>> b <4>
|
||||
b'na\xefve'
|
||||
>>> s <5>
|
||||
'naïve'
|
||||
>>> b == s.encode('iso8859-1') <6>
|
||||
True
|
||||
>>> s[2] <7>
|
||||
'ï'
|
||||
>>> b[2] <8>
|
||||
239
|
||||
>>> ord(s[2]) <9>
|
||||
239
|
||||
>>> s.upper() <10>
|
||||
'NAÏVE'
|
||||
>>> b.upper() <11>
|
||||
b'NA\xefVE'
|
||||
Reference in New Issue
Block a user