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, ∼2130🔥, 0💬
Popular Posts:
How to use the "@(...)" expression in Azure API Policy? The "@(...)" expression in Azure API Policy ...
How to convert a JSON text string to an XML document with PHP language? Currently, there is no built...
How to reinstall npm with a node version manager? I am getting permission errors with the current ve...
How to build a PHP script to dump Azure AD 2.0 Authentication Response? If you are use the Azure-AD-...
How to use the RSS Online Validator at w3.org? You can follow this tutorial to learn how to use the ...