Tools, FAQ, Tutorials:
'bytes' Literals and Conversions
How to specify "bytes" values in Python code?
✍: FYIcenter.com
"bytes" values can be specified using "bytes" literals or
the bytes() conversion function as shown in this tutorial:
1. "bytes" literals in b'...' or b"..." format as shown below:
>>> b'FYIcenter.com' b'FYIcenter.com' >>> b"Name\t\x41ge\n" b'Name\tAge\n'
2. bytes() function converting "string" data type to "bytes":
>>> bytes("FYIcenter.com","utf8")
b'FYIcenter.com'
>>> bytes("française","utf8")
b'fran\xc3\xa7aise'
3. bytes() function converting a list of integers in the range of 0 and 255 to "bytes":
>>> bytes((1,2,3)) b'\x01\x02\x03' >>> bytes((65,66,67,68)) b'ABCD'
⇒ 'list' Literals and Conversions
⇐ 'str' Literals and Conversions
2018-04-07, ∼2262🔥, 0💬
Popular Posts:
Why I am getting "The Windows SDK version 8.1 was not found" error, when building my C++ application...
How to make application release build with Visual Studio 2017? If you want to make a final release b...
What is Fabric CA (Certificate Authority)? Fabric CA (Certificate Authority) is a component of Hyper...
Where to find tutorials on EPUB file format? I want to know how to create EPUB books. Here is a larg...
Where to find tutorials on HTML language? I want to know how to learn HTML. Here is a large collecti...