Simple (?) question: wiki mardown to HTML
Hi Paul, Thanks for the hint - I indeed meant markup and not markdown. Regarding the strip: the sample code that I posted was an interim snapshot - the intention was to remove trailing newlines which screwed up subsequent code not part of the snippet. But instead of calling strip() the following works just as well: for line in f: if line [-1] == '\n': l0 = line [:-1] else: l0 = line lines.append(l0) Thanks again for your input! -- This email account is monitored seven days a week.
On Thursday 27. July 2017 14.16.23 Christoph wrote:
Thanks for the hint - I indeed meant markup and not markdown.
No problem! Markdown isn't exactly the most sensible name someone could have chosen for a text format. ;-)
Regarding the strip: the sample code that I posted was an interim snapshot - the intention was to remove trailing newlines which screwed up subsequent code not part of the snippet.
But instead of calling strip() the following works just as well:
for line in f: if line [-1] == '\n': l0 = line [:-1] else: l0 = line lines.append(l0)
Thanks again for your input!
You could use rstrip, potentially with "\r\n" as argument if you don't want to strip tabs and spaces. Paul
participants (2)
-
Christoph -
Paul Boddie