bytearray.py

>>> 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
Translate to normal string

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.