Created
April 18, 2019 17:28
-
-
Save luisenriquecorona/1ebeb855297fdc80c4ebfc895ae53ffe to your computer and use it in GitHub Desktop.
Translate to normal string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> S = 'shrubbery' | |
>>> L = list(S) | |
>>> L | |
['s', 'h', 'r', 'u', 'b', 'b', 'e', 'r', 'y'] >>> L[1] = 'c' | |
>>> ''.join(L) 'scrubbery' | |
>>> B = bytearray(b'spam') >>> B.extend(b'eggs') | |
>>> B bytearray(b'spameggs') | |
>>> B.decode() 'spameggs' | |
# Expand to a list: [...] | |
# Change it in place | |
# Join with empty delimiter | |
# A bytes/list hybrid (ahead) # 'b' needed in 3.X, not 2.X # B[i] = ord(c) works here too | |
# Translate to normal string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment