944,198 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Unsolved
  • Views: 2178
  • Python RSS
Nov 2nd, 2007
0

Python Regular Expression

Expand Post »
I need to find a regular expression in Python. My text string is:

2007-10-12,163.01,167.28,161.80,167.25

I want to extract only the last part: 167.25 (end of line part)

I tried using
regex="(?=[,].+?(?=[\\n]))"
but it did not work. What will be the answer?

Thanks!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
cyberdon is offline Offline
1 posts
since Nov 2007
Nov 2nd, 2007
1

Re: Python Regular Expression

Use string.split() instead and split on the commas. Python has a csv module (comma separated variables), but it looks like that would be overkill here.
Reputation Points: 741
Solved Threads: 694
Nearly a Posting Maven
woooee is offline Offline
2,314 posts
since Dec 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: Please help regarding Python path
Next Thread in Python Forum Timeline: Noob needs help i/o file data





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC