Which statement creates the Bytes Literal when run in Python
In Python, a bytes literal is defined in the same way as a string literal with the addition of a 'b'
prefix.
A bytes literal produces a new object each time it is evaluated, like list displays and unlike string literals.
The bytes method returns a immutable bytes object initialized with the given size and data. It takes three optional parameters such as source, encoding, errors.
>>> x = b'pythonpoint' >>> x b'pythonpoint' >>> type(x) <class 'bytes'> >>> y = b"python" >>> y b'python' >>> type(y) <class 'bytes'> >>>
Subscribe
Login
Please login to comment
0 Discussion