def __init__(self, text):
self.text = text.strip("\r").strip("\n").strip("\r").strip(" ")
print("TEXT:"+text+";SELFTEXT:"+self.text)
text
is inputed as "http://thehill.com/homenews/senate/376515-jeff-flake-there-will-be-a-republican-challenger-to-trump-in-2020\r\n"
and the self.text
is still the same (does not remove the \r
and the \n
).
when this code is put on the Shell for Python it works as desired. Any ideas?
edit: when the print statement is changed to print("REPR:"+repr(text)+"\nTEXT:"+text+";SELFTEISXT:"+self.text)
the output for a similar string is:
REPR:'http://thehill.com/homenews/senate/376548-lindsey-graham-war-with-north-korea-would-be-worth-it-in-the-long-run\r\n' TEXT:http://thehill.com/homenews/senate/376548-lindsey-graham-war-with-north-korea-would-be-worth-it-in-the-long-run\r\n;SELFTEISXT:http://thehill.com/homenews/senate/376548-lindsey-graham-war-with-north-korea-would-be-worth-it-in-the-long-run\r\n