I have this code:
Hexline – string in hex (080a00000135627c43784… etc)
Date = Hexline[:16]
Prio = Hexline[16:2]
Date = "0x"+Date
DecDate = long(Date, 16)
print 'date = %s' % DecDate
print 'prio = %s' % int(Prio, 16)
- I get first 16 symbols and convert it in BigInt
- I need to get next two symbols after “Date” from “Hexline” and convert it to Decimal.
But on step 2 i got “invalid literal for int() with base 16 ” ” error. (Prio = ”)
What’s wrong?
Priowill always end up to be an empty string. You probably meanThe number after the colon is the stop index of the substring, not its length.