accessing individual element in a list.

future_retro at yahoo.co.uk future_retro at yahoo.co.uk
Fri Jul 1 13:34:49 CEST 2005


hi all,could someone clear this up for me.  I'm sure it's probably very
simple but I can't seem to get my head round it.....

doing the following

>>> import wmi
>>> c = wmi.WMI()
>>> for printdriver in c.Win32_PrinterDriver():
... 	pd = printdriver.Name
>>> print pd
AGFA-AccuSet v52.3,3,Windows NT x86
>>> pd[1]
u'G'
>>> pd.split(',')
[u'AGFA-AccuSet v52.3', u'3', u'Windows NT x86']
>>> pd[0]
u'A'

why does pd[1] or pd[0] not return an element from the list instead of
a character from the string?  Is split the best method to try and
seperate the individual elements?

Thanks, MW.




More information about the Python-list mailing list