A RetroSearch Logo

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

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-October/029715.html below:

[Python-Dev] textwrap and unicode

[Python-Dev] textwrap and unicode [Python-Dev] textwrap and unicodeFredrik Lundh fredrik@pythonware.com
Tue, 22 Oct 2002 22:04:25 +0200
greg wrote:
> But I still don't know how to replace all whitespace with
> space

string.join(phrase.split(), " ")

or

re.sub("(?u)\s+", " ", phrase)

not sure which one's faster; I suggest benchmarking.

(if you want to preserve leading/trailing space with the split
approach, use isspace on the start/end of phrase)

> or detect words that end with a lowercase letter.

word[-1].islower()

</F>




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