|
From: Tom V. <to...@so...> - 2010-03-09 17:25:01
|
I mean how do I make sure a hex string is written to the .ini file, not the decimal equivalent? Sent from my iPhone On Mar 9, 2010, at 6:23, David Hostetler <neg...@gm...> wrote: > you mean... how do you print a hex value as a string? > > '%#x' % (val) > > Omit the '#' if you don't want the leading '0x'. > > > http://docs.python.org/library/string.html#format-specification-mini-language > > > -David > > > On Mon, Mar 8, 2010 at 15:36, Tom Vaughan <to...@so...> wrote: > Hi, > > I know how to convert a hex string to an int. But how would I write > out the hex string? Thanks. > > -Tom > > > class Preferences(ConfigObj): > > def conv_hex(value): > return int(value, 16) > > fdict = { > 'hex': conv_hex, > } > > def __init__(self, prefsname): > specsname = prefsname + '.spec' > if os.path.exists(specsname): > ConfigObj.__init__(self, prefsname, > configspec=specsname) > self.validate(Validator(self.fdict)) > else: > ConfigObj.__init__(self, prefsname) > > --- > --- > --- > --------------------------------------------------------------------- > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Configobj-develop mailing list > Con...@li... > https://lists.sourceforge.net/lists/listinfo/configobj-develop > > --- > --- > --- > --------------------------------------------------------------------- > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Configobj-develop mailing list > Con...@li... > https://lists.sourceforge.net/lists/listinfo/configobj-develop |