Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #58980
| From | Piet van Oostrum <piet@vanoostrum.org> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: splitting file/content into lines based on regex termination |
| Date | 2013-11-09 21:05 -0400 |
| Message-ID | <m2iow1awxs.fsf@cochabamba.vanoostrum.org> (permalink) |
| References | <CAP16ngqrVAnJPxBXi8B-cAL_Q+yr47pQs1WxhvCHLM8oeVKpsg@mail.gmail.com> <CAP16ngpgdF=uYr5j8OLtBZqEmsUw9f6XPg-5Rd8HpzhBjoSpyw@mail.gmail.com> <527BD83A.7020604@mrabarnett.plus.com> <mailman.2149.1383849945.18130.python-list@python.org> |
bruce <badouglas@gmail.com> writes: > hi. > > thanks for the reply. > > tried what you suggested. what I see now, is that I print out the > lines, but not the regex data at all. my initial try, gave me the > line, and then the next items , followed by the next line, etc... exp = re.compile(r"(<br>#\d+\s*/\s*\d+#\d+#)") exp.split(s) => ['10116#000#C S#S#100##001##DAY#Fund of Computing#Barrett,\nWilliam#3#MWF<br>#08:00am<br>#08:50am<br>#3718 HBLL ', '<br>#45 /\n58#0#', '10116#000#C S#S#100##002##DAY#Fund of Computing#Barrett,\nWilliam#3#MWF<br>#09:00am<br>#09:50am<br>#3718 HBLL ', '<br>#9 /\n58#0#', '10178#000#C S#S#124##001##DAY#Computer Systems#Roper,\nPaul#3#MWF<br>#11:00am<br>#11:50am<br>#1170 TMCB ', '<br>#41 /\n145#0#', '10178#000#C S#S#124##002##DAY#Computer Systems#Roper,\nPaul#3#MWF<br>#2:00pm<br>#2:50pm<br>#1170 TMCB ', '<br>#40 /\n120#0#', "01489#002#C S#S#142##001##DAY#Intro to Computer\nProgramming#Burton, Robert <div class='instructors'>Seppi, Kevin<br\n/></div>"] -- Piet van Oostrum <piet@vanoostrum.org> WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4]
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: splitting file/content into lines based on regex termination bruce <badouglas@gmail.com> - 2013-11-07 13:45 -0500 Re: splitting file/content into lines based on regex termination Piet van Oostrum <piet@vanoostrum.org> - 2013-11-09 21:05 -0400
csiph-web