A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/345392.html below:

Newbie regular expression and whitespace question

Newbie regular expression and whitespace question Newbie regular expression and whitespace questionBruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Thu Sep 22 16:50:24 EDT 2005
googleboy a écrit :
> Hi.
> 
> I am trying to collapse an html table into a single line.  Basically,
> anytime I see ">" & "<" with nothing but whitespace between them,  I'd
> like to remove all the whitespace, including newlines. I've read the
> how-to and I have tried a bunch of things,  but nothing seems to work
> for me:
> 
> --
> 
> table = open(r'D:\path\to\tabletest.txt', 'rb')
> strTable = table.read()
> 
> #Below find the different sort of things I have tried, one at a time:
> 
> strTable = strTable.replace(">\s<", "><") #I got this from the module
> docs

 From which module's doc ?

">\s<" is the litteral string ">\s<", not a regular expression. Please 
re-read the re module doc, and the re howto (you'll find a link to it in 
the re module's doc...)

More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4