長いバージョンの文字列を置くと良いでしょう。 どうすればいいですか?それは答えである:
import re
str = "2016-02-13 02:00:00.0,3525,http://www.heatherllindsey.com/2016/02/my-husband-left-his-9-5-job-for-good-it.html,158,0,2584490"
pattern = re.compile("(.*?),", re.DOTALL) #we use re.DOTALL to continue splitting after endlines.
result = pattern.findall(str) #we can't find the last statement (2584490) because of the pattern so we will apply second process
pattern = re.compile("(.*?)", re.DOTALL)
str2 = str[-50:-1]+str[-1] #we take last partition of string to find out last statement by using split() method
result.append(str2.split(",")[-1])
print result
それが動作する...
それが正規表現に来るときあなたは非常に特異的であるべきです。あなたは何の試みもしておらず、あなたが本当に必要なものを確かめることができません。 *この文字列にマッチするために '。+'を使うだけで、このようなあいまいな質問に対して有効な答えとなります。これまでに書いたコードと正規表現を明確にして追加してください。 –