Python strings and arrays of bytes

When using Python to do network programming will inevitably encounter convert a string to the byte stream,Here we record the following commonly used methods:

First byte array to a string,That is str:

Then the string to a byte array:

Either the above two methods are possible。

Original article written by Gerber drop-off:R0uter's Blog » Python strings and arrays of bytes

Reproduced Please keep the source and description link:https://www.logcg.com/archives/1686.html

By R0uter's Blog

The non-declaration,I have written articles are original,Reproduced, please indicate the link on this page and my name。

1 comment

Leave a comment

Your email address will not be published. Required fields are marked *