Sep-07-2024, 03:49 AM
I am new to python, but not to coding. I have been coding in C, C++, php and some others but just started coding in python. I have come across a piece of code that I don't understand and can't find any references in the documentation (probably because I don't know where to look in the documentation). Here is the code:
decoded_bytes = float(ser_bytes[0:len(ser_bytes)-2].decode("utf-8"))
The piece I don't understand is the (ser_bytes[0:len(ser_bytes)-2].decode("utf-8") where ser_bytes is previously defined by
ser_bytes = ser.readline(). I get the len() and decode() functions, but the [0:...] has me baffled. Can someone tell me what this might be? Some kind of array?
Thanks.
decoded_bytes = float(ser_bytes[0:len(ser_bytes)-2].decode("utf-8"))
The piece I don't understand is the (ser_bytes[0:len(ser_bytes)-2].decode("utf-8") where ser_bytes is previously defined by
ser_bytes = ser.readline(). I get the len() and decode() functions, but the [0:...] has me baffled. Can someone tell me what this might be? Some kind of array?
Thanks.