擅长:python、mysql、java
<p>你忘了继承类。见下文。答案与Python3兼容;但说真的。。。这不是激励人心的方法。为了长期兼容,您应该通过版本控制进行检查,并使用if语句。在</p>
<pre><code>image = "aztec.png"
zxing = zxing() # notice zxhing()
rd = zxing.BarCodeReader()
rs = rd.decode(image)
try:
print (rs.data)
print (rs)
except:
print (rs.data)
print (rs)
</code></pre>