Python 3 bytes comparison

question Code:

if ch>=b"0"

(Pdb) type (ch)
< class" bytes" >
(Pdb) type (baked 0")
< class" bytes" >

TypeError:"> = "not supported between instances of" bytes" and "str"
how to solve this problem?

do you need the complete code

Apr.07,2022

are all converted to int types for comparison

num = int(b'0')
ch = int(ch)
if ch >= num:
    pass
Menu