Converting hex string to an integer

Batista, Facundo FBatista at
Thu Aug 26 14:56:11 CEST 2004

[Rick Holbert]

#- > Given the character string "0x00A1B2C3" arriving at 
#- sys.argv[1] how do I
#- > convert that to an integer which I can do some math on?
#- i = eval(sys.argv[1])

This is *DANGEROUS*.

Never do that.

You're executing something that you get from the exterior without control!
Just think what happens if a pass to the program

	"import os;os.remove('/')"

.	Facundo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list