hex

H

hong zhang

List,

I want to input hex number instead of int number. in type="int" in following,

parser.add_option("-F", "--forcemcs", dest="force_mcs", type="int", default=0, help="index of 11n mcs table. Default: 0.")

How can I do it?
Thanks.

--henry
 
D

Diez B. Roggisch

hong said:
List,

I want to input hex number instead of int number. in type="int" in following,

parser.add_option("-F", "--forcemcs", dest="force_mcs", type="int", default=0, help="index of 11n mcs table. Default: 0.")

How can I do it?

You can't. You can get a string, and convert that with e.g.

int("FF", 16)

Or you can extend optparse to know a new type, should be possible. That
would have the advantage that the parser already knows about it & can
reject faulty input.

Diez
 
P

Peter Otten

hong said:
I want to input hex number instead of int number. in type="int" in
following,

parser.add_option("-F", "--forcemcs", dest="force_mcs", type="int",
default=0, help="index of 11n mcs table. Default: 0.")

How can I do it?

Workaround for the lazy: '0xff' on the command line instead of 'ff'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top