From 84b83a9c481030935e3d6daafab25a2c725f87b3 Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Wed, 18 Mar 2015 23:25:15 +0100 Subject: [PATCH] Strip whitespaces from strings --- getter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/getter.py b/getter.py index e096b0b..387d682 100755 --- a/getter.py +++ b/getter.py @@ -33,14 +33,14 @@ while True: for status in timeline: if status.text.find("@" + user) > 1: continue - text = status.text.encode("UTF-8")[status.text.find(" ")+1:] + text = status.text.encode("UTF-8")[status.text.find(" ")+1:].strip() sender = status.user.screen_name.encode("UTF-8") twid = int(status.id) try: if "-" in text: loc = text.find("-") date = dateutil.parser.parse(text[:loc-1]) - comment = HTMLParser.HTMLParser().unescape(text[loc+1:]) + comment = HTMLParser.HTMLParser().unescape(text[loc+1:]).strip() else: date = dateutil.parser.parse(text) comment = ""