To convert a "bytes" type to string type, one can use the decode("utf-8") function:
>>> l = b'hello world'>>> lb'hello world'>>> type(l)<class 'bytes'>>>> s = l.decode("utf-8")>>> type(s)<class 'str'>>>> s'hello world'
Example of application with ssh tunnek and pexpect: here
References
| Links | Site |
|---|---|
| Convert bytes to a string? | stackoverflow |
| Built-in Types | python doc |
| unicode | python doc |
