RFID Tag value import problems
Posted: Tue Nov 28, 2017 5:09 pm
Hey folks,
I'm writing a little program using the RFID libary from Github(https://github.com/mxgxw/MFRC522-python). When I extract the data from the tag and convert it into an integer to work with it I get an Error like this
I know why I get this error. The reason is how the string realy looks like. With an "print()" it shows me a 10 but with "print(repr())"
Now to my question: Is there any better/other solution to get and clean string from the card without "\x00"?
I'm writing a little program using the RFID libary from Github(https://github.com/mxgxw/MFRC522-python). When I extract the data from the tag and convert it into an integer to work with it I get an Error like this
Code: Select all
ValueError: invalid literal for int(): 10I also know that \x00 stands for Null in HEX, and I also found a solution to solve the problem. My actual code snipped is'10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Code: Select all
DecimalValueCard= MIFAREReader.MFRC522_Read(BlockID)
Variable = ''.join(chr(i) for i in DecimalValueCard)
print(repr(Variable .strip('\x00')))
print(repr(Variable .strip("'")))
print(repr(Variable ))