You can do it with regexps too :

>------------------------------------------------------------------
import re
to_watch = re.compile(r"(?P<number>\d+)[/](?P<letter>[A-Z]+)")

final_list = to_watch.findall("12560/ABC,12567/BC,123,567,890/JK")

for number,word in final_list :
    print "number:%s -- word: %s"%(number,word)
>------------------------------------------------------------------

the output is :

number:12560 -- word: ABC
number:12567 -- word: BC
number:890 -- word: JK

See you,

KibĀ².
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to