0

The literal values expressed in python as

'b"8.23"' and 'b"1.25"'

These are expressions specific to python.

yash bhangare
  • 319
  • 2
  • 9
  • This is a byte literal (in Python 3). See https://stackoverflow.com/questions/6269765/what-does-the-b-character-do-in-front-of-a-string-literal – Gerriet May 20 '21 at 07:49
  • Does this answer your question? [What is the difference between a string and a byte string?](https://stackoverflow.com/questions/6224052/what-is-the-difference-between-a-string-and-a-byte-string) – awesoon May 20 '21 at 07:49
  • Yes awesoon and gerriet – yash bhangare Jun 27 '21 at 11:43

2 Answers2

1

The b character before a string produces a variable of byte type instead of string type. You may read about this definition on the official website.

bluevulture
  • 422
  • 4
  • 16
1

The character 'b' shows that the given variable is of type byte, not string.

Let me distinguish between string and byte definitions to make it clear,

str = '...' 
# Above literals is sequence of Unicode characters (Latin-1, UCS-2 or UCS-4)
bytes = b'...' 
# Above literals are sequence of octets (integers between 0 and 255)

)