Re: Parsing/Splitting Line

2006-11-22 Thread Georg Brandl
Fredrik Lundh schrieb: > Noah Rawlins wrote: > > >> I'm a nut for regular expressions and obfuscation... >> >> import re >> def splitline(line, size=4): >> return re.findall(r'.{%d}' % size, line) >> >> >>> splitline("helloiamsuperman") >> ['hell', 'oiam', 'supe', 'rman'] > > there are l

Re: Parsing/Splitting Line

2006-11-22 Thread Fredrik Lundh
Noah Rawlins wrote: > I'm a nut for regular expressions and obfuscation... > > import re > def splitline(line, size=4): > return re.findall(r'.{%d}' % size, line) > > >>> splitline("helloiamsuperman") > ['hell', 'oiam', 'supe', 'rman'] there are laws against such use of regular expressio