Menu

commaSeparatedList Not Working Accross Newline

Jim P
2014-03-14
2014-03-14
  • Jim P

    Jim P - 2014-03-14

    commaSeparatedList will not work across newlines:

    from pyparsing import *
    greet = commaSeparatedList
    hello = "Hello, World!\nyes,me\nwhat,yes"
    result = greet.parseString( hello )
    print result

    ['Hello', 'World!']

    If I wrap commaSeparatedList in OneOrMore it enters an infinite loop and I am not sure why. I would like to avoid going line by line and using commaSeparatedList.

    Thanks

     
    • DangGriffith

      DangGriffith - 2014-03-14

      Sorry I can't help you, but if it helps Paul or anyone else, it works with
      Python 3 (after changing the print to print(), of course).

      On Fri, Mar 14, 2014 at 1:19 PM, Jim P jimppp3@users.sf.net wrote:

      commaSeparatedList will not work across newlines:

      from pyparsing import *
      greet = commaSeparatedList
      hello = "Hello, World!\nyes,me\nwhat,yes"
      result = greet.parseString( hello )
      print result

      ['Hello', 'World!']

      If I wrap commaSeparatedList in OneOrMore it enters an infinite loop and
      I am not sure why. I would like to avoid going line by line and using
      commaSeparatedList.

      Thanks

      commaSeparatedList Not Working Accross Newlinehttps://sourceforge.net/p/pyparsing/discussion/337293/thread/25eec2e3/?limit=50#1a02

      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/pyparsing/discussion/337293/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.