Parsing Strings in Enclosed in Curly Braces

2009-05-15 Thread xamalek
How do you parse a string enclosed in Curly Braces?

For instance:

x = "{ABC EFG IJK LMN OPQ}"

I want to do x.split('{} ') and it does not work. Why does it not work
and what are EXCEPTIONS to using the split method?

That I want to split based on '{', '}' and WHITESPACE.

Please advise.

Regards,
Xav
-- 
http://mail.python.org/mailman/listinfo/python-list


Printing a hex character and prefixing it correctly

2009-05-15 Thread xamalek
If I have an integer k, for instance;

k = 32 // BASE 10

How do I get print to print it out in HEX and PREFIXED with 0x? What
is the PROPER WAY?

This does not work:

  print "This is hex 32: ", int(k, 16)

Xav
-- 
http://mail.python.org/mailman/listinfo/python-list