import RPi.GPIO as GPIO
import SimpleMFRC522
reader = SimpleMFRC522.SimpleMFRC522()
try:
text = int(raw_input('New data:'))
print("Now place your tag to write")
reader.write(text)
print("Written")
finally:
GPIO.cleanup()
运行后出现此错误: AttributeError:'int'对象没有属性'ljust'
答案 0 :(得分:1)
在开始时删除int()
转换:
text = raw_input('New data:')
...因为write()
似乎不支持int
作为参数:
reader.write(text) # here was the problem