Matthias Winterland wrote: > Hi, > > I have a simple question. When I read in a string like: > a='1,2,3,4,5 6 7,3,4', can I get the list l=[1,2,3,4,5,6,7,3,4] with a > single split-call? > > Thx, > Matthias
Sorry, I didn't notice there are spaces between 5 6 7 :{P here is new code: >>> a = "1,2,3,4,5 6 7,3,4" >>> l = [int(n) for n in a.replace(' ',',').split(',')] >>> l [1, 2, 3, 4, 5, 6, 7, 3, 4] >>> wutiefeng 2006-11-10 ___________________________________________________________ 抢注雅虎免费邮箱-3.5G容量,20M附件! http://cn.mail.yahoo.com
-- http://mail.python.org/mailman/listinfo/python-list