Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
hi I get user argv from command line as follows: '0x000aff00'
'0x000aff00'
and I want python to treat it as hex directly...
str = sys.argv[1]
how is it possible? thanks!
str
Try: i = int(sys.argv[1], 16)
i = int(sys.argv[1], 16)
Add a comment
try: i = int(sys.argv[1], 16) except Exception,e: print e else: # carry on
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
str) that is the same as a data type (str). It's a bad thing to do.