Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #108687

Re: A tough one: split on word length?

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.python
Subject Re: A tough one: split on word length?
Date 2016-05-16 20:27 +0100
Organization A noiseless patient Spider
Message-ID <87bn45ztv5.fsf@bsb.me.uk> (permalink)
References <nhcmpg$gi6$1@dont-email.me>

Show all headers | View raw


DFS <nospam@dfs.com> writes:

> Have:
> '584323 Fri 13 May 2016 17:37:01 -0000 (UTC) 584324 Fri 13 May 2016
> 13:44:40 -0400 584325 13 May 2016 17:45:25 GMT 584326 Fri 13 May 2016
> 13:47:28 -0400'
>
> Want:
> [('584323', 'Fri 13 May 2016 17:37:01 -0000 (UTC)'),
>   ('584324', 'Fri 13 May 2016 13:44:40 -0400'),
>   ('584325', '13 May 2016 17:45:25 GMT'),
>   ('584326', 'Fri 13 May 2016 13:47:28 -0400')]

  [m for m in re.findall(r'(\d{6}) (.*?) ?(?:(?=\d{6})|$)', s)]

<snip>
-- 
Ben.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

A tough one: split on word length? DFS <nospam@dfs.com> - 2016-05-16 10:54 -0400
  Re: A tough one: split on word length? Laurent Pointal <laurent.pointal@free.fr> - 2016-05-16 19:13 +0200
    Re: A tough one: split on word length? DFS <nospam@dfs.com> - 2016-05-16 16:29 -0400
  Re: A tough one: split on word length? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-05-16 20:27 +0100
    Re: A tough one: split on word length? DFS <nospam@dfs.com> - 2016-05-16 16:50 -0400

csiph-web