Message195045
In shorten function of textwrap module, the placeholder becomes a hole where we can inject non-normalized whitespaces to the text.
>>> text = "Hello there, how are you this fine day? I'm glad to hear it!"
>>> from textwrap import shorten
>>> shorten(text, 40, placeholder=" ")
'Hello there, how are you'
We normalize the only-whitespaces placeholder.
But....
>>> shorten(text, 17, placeholder=" \n\t(...) \n\t[...] \n\t")
'(...) \n\t[...]'
>>> shorten(text, 40, placeholder=" \n\t(...) \n\t[...] \n\t")
'Hello there, how \n\t(...) \n\t[...]'
Attached the patch to normalize the non-normalized whitespaces in placeholder. |
|
Date |
User |
Action |
Args |
2013-08-13 06:26:52 | vajrasky | set | recipients:
+ vajrasky, pitrou |
2013-08-13 06:26:52 | vajrasky | set | messageid: <1376375212.1.0.637444277248.issue18723@psf.upfronthosting.co.za> |
2013-08-13 06:26:51 | vajrasky | link | issue18723 messages |
2013-08-13 06:26:51 | vajrasky | create | |
|