Me (indented by 2) and the chatbot (flush left). Lines lengths > 72!
Assume you have an expression "s.replace('a','b').replace('c','d'). replace('e','f').replace('g','h')". Its value is a string which
is the value of s, but with "a" replaced by "b", "c" replaced by
"d", "e" replaced by "f" and "g" replaced by "h". How to modify
this expression, so that "a", "c", "e", and "g", respectively,
are replaced only if they are words (but not parts of words)?
ram@zedat.fu-berlin.de (Stefan Ram) writes:
Me (indented by 2) and the chatbot (flush left). Lines lengths > 72!
Is there a name for this kind of indentation, i.e. the stuff you are
writing not being flush left?
It is sort of contrary to what I think of as "normal" indentation.
ram@zedat.fu-berlin.de (Stefan Ram) writes:
Me (indented by 2) and the chatbot (flush left). Lines lengths > 72!
Is there a name for this kind of indentation, i.e. the stuff you are
writing not being flush left? It is sort of contrary to
what I think of as "normal" indentation. You seem to use it in all your postings, too, which hurts my brain, but I guess that's my problem :-)
[snip (40 lines)]
complex, I happen to use Google-Translator. It makes bad translations if
the lines are interrupted by the newline, so I wrote a tool dedicated to >Stefan and to all those who indent like him. This tool takes the text
from the clipboard, removes all the superfluous spaces, combines all the >lines in one and puts the result back into the clipboard. :-D
translation services are gonna interpret line breaks as
ram@zedat.fu-berlin.de (Stefan Ram) wrote or quoted:
translation services are gonna interpret line breaks as
I just beefed up my posting program to replace "gonna".
Now I won't come across like some street thug, but rather
as a respectable member of human society!
# replace complete words
replacements =\
{ rb'kind of': b'kind of',
rb'trying to': b'trying to',
rb'got to': b'got to',
rb'gonna': b'going to',
}
lines =\
[ re.sub( rb"\b(" + b"|".join( replacements.keys() ) + rb")\b",
lambda x: replacements[ x.group() ], line )
if len( line )and line[ 0 ]not in b'>|' else line for line in lines ]
Well, that won't fly in Python because indentation actually affects
the code's meaning.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (2 / 14) |
Uptime: | 51:41:54 |
Calls: | 10,397 |
Calls today: | 5 |
Files: | 14,067 |
Messages: | 6,417,343 |
Posted today: | 1 |