In <[EMAIL PROTECTED]>, saif.shakeel
wrote:

>      I have just started learning python.I need to parse an XML file
> and present the contents in a particular format.The format is called
> as "ini" file.I have written some code.A section of the format needs
> the data to be present in format as given below:
> 
> [Services]
> supported=0x10,0x1A,0x3B,0x20,0x27,0x28,0x34,0x36,0x3E,0xA2,0xA5,0x2D,
> 0x22,0xA9,0x04,0xAA,0xAE
> 
> My code for this section parses the xml file and gives :
> [Services]
> Supported=['0x3e', '0x28', '0x3b', '0x22', '0x20', '0x27', '0xaa',
> '0x10', '0xae', '0x34', '0x36', '0x2d', '0xa9', '0xa5', '0x4', '0xa2',
> '0x1a']
> 
>                 {forget the numericals matching}.As you can see there
> are single quotes around numericals ,which is not desired .I think the
> problem lies in me using a list for storing and later printing out
> values.

It's not that you store them in the list but that you simply print the
string representation of the list which does not meet your requirements. 
You want to join the list elements with a comma::

  print 'supported=%s' % ','.join(ser)

Ciao,
        Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to