Re: Sequence splitting

2009-07-03 Thread tsangpo
Just a shorter implementation: from itertools import groupby def split(lst, func): gs = groupby(lst, func) return list(gs[True]), list(gs[False]) "Lie Ryan" дÈëÏûÏ¢ÐÂÎÅ:nfi3m.2341$ze1.1...@news-server.bigpond.net.au... > Brad wrote: >> On Jul 2, 9:40 pm, "Pablo Torres N." wrote: >>>

can it be shorter?

2009-06-07 Thread tsangpo
I want to ensure that the url ends with a '/', now I have to do thisa like below. url = url + '' if url[-1] == '/' else '/' Is there a better way? -- http://mail.python.org/mailman/listinfo/python-list

Re: can it be shorter?

2009-06-06 Thread tsangpo
"kj" 写入消息 news:h0e3p9$85...@reader1.panix.com... In "tsangpo" writes: I want to ensure that the url ends with a '/', now I have to do thisa like below. url = url + '' if url[-1] == '/' else '/' Is there a better way? I