Hi ,
Have downloaded a feed from a news site and trying to show only the first paragraph for each story. At present, the output to email looks like this:
"http://www.nzherald.co.nz/nz/news/article.cfm?c_id=1&objectid=10568455&ref=rss" Man arrested after pointing fake gun at police (A 59-year-old man has been arrested after pointing an imitation gun at police from his car in Paekakariki, north of Wellington, this morning.
When police approached his vehicle on Paekakariki Hill Rd after receiving a call over...)
Looking in the shell, the output is:
"http://www.nzherald.co.nz/nz/news/article.cfm?c_id=1&objectid=10568455&ref=rss" Man arrested after pointing fake gun at police (A 59-year-old man has been arrested after pointing an imitation gun at police from his car in Paekakariki, north of Wellington, this morning.\r\n\r\nWhen police approached his vehicle on Paekakariki Hill Rd after receiving a call over...)\r\n
So it appears the issue is the \r\n\r\n. Have tried removing with re.sub but it doesn't want to go; got a little excited when I read about rstrip() but I can not get that working (at a guess because I'm trying to run it on a txt file rather than a string).
Read on one site that using readlines() would make a txt.file a list, which would allow the use of rstrip(), but that doesn't seem to work for me either.
Should I persevere with re.sub or rstrip(), or am I on the wrong track entirely?
Blair
PS: Apologies for length: noticed the note that help would not be given to those who could not demonstrate they had at least tried to solve their problem themselves. And no, it's not homework... left that behind about 15 years ago.