问题
So it turns out that PyQt redefines a function hex()
, which unfortunately renders the python standard library hex()
unusable. I'm working on a large software project and it's been set up with *imports:
from PyQt4.QtCore import *
from PyQt4.QtGui import *
...etc
I need the standard python hex()
function, is there any way for me to reference it? I'm thinking of a stdlib.hex()
or something like that?
Currently my ugly workaround is:
pyHex = hex
from PyQt4.QtCore import *
from PyQt4.QtGui import *
hex = pyHex
and I'd really prefer to not have to do that.
Thanks.
回答1:
from __builtin__ import hex
Use the __builtin__ module.
来源:https://stackoverflow.com/questions/24562216/directly-reference-pythons-standard-library