"Disabling" raw string to print newlines

Paul McGuire ptmcg at austin.rr.com
Mon May 19 09:01:19 EDT 2008


On May 19, 4:54 am, kuratk... at kuratkull.com wrote:
> Hello,
>
> ***************
> import urllib2
> import re
> import string
> import sys
>
> url = "http://www.macgyver.com/"
> request = urllib2.Request(url)
> opener = urllib2.build_opener()
> html = opener.open(request).read()
>
> match = re.compile("<PRE>(.+)</PRE>", re.DOTALL)
>
> out = match.findall(html)
>
> print out
> **************
>
> I would like to print out string with formatting, but as I read, the
> string is made into a raw string when using re.
> How could I disable or bypass this?
>
> I googled for an hour and couldn't find a solution.
>
> Thank you in advance.

Change your print statement to:

print out[0]

-- Paul



More information about the Python-list mailing list