-1

I'm trying to convert a hex string 'aa' to binary as following:

a = bin(int('aa',16))

But it gives me the error of:

Traceback (most recent call last):
  File "<pyshell#23>", line 1, in <module>
    a = bin(int('aa',16))
TypeError: bin(QTextStream): argument 1 has unexpected type 'int'

Can anyone explain what is the problem with the conversion?

lwangreen
  • 136
  • 2
  • 12

1 Answers1

1

You did some sort of import *, probably

from PyQt4.QtCore import *

causing the built-in bin to be shadowed by a different function. Stop using import *, and the problem will go away.

user2357112
  • 260,549
  • 28
  • 431
  • 505