-
Olaf
You can use \1 to refer to matched text grouped by () in the regex. So:
import re my_text = 'Word word' src_str = re.compile('(word)', re.IGNORECASE) my_text = src_str.sub(r'\1xxx', my_text) print(my_text)
-
Olaf
dict
is a built-in type, not a module that needsimport
ing
What are you trying to accomplish, @Sway? -
-
-
Olaf
@JITASIDA
No, you can't
That would require adding a method to a built-in type and that's not possible (without going to the C source for Python):>>> str.clean=lambda self:'clean'+self Traceback (most recent call last): File "<string>", line 1, in <module> TypeError: can't set attributes of built-in/extension type 'str'
-
Olaf
The error results from your lines not being well-aligned
Unindenting thex=...
andy=...
lines should fix it -
-
Olaf
Okay, I'll try my luck at some parts of scene
Well, no luck :-(
pygenstub
will not install (pip install
) at my iPad withFile Not Found Error
.
pip
successfully downloads the.whl
frompythonhosted.org
, but on installing the wheel stops at an error
Version 1.2 (current version is 1.4) installs -
Olaf
Very welcome initiative!
I may contribute a module or two that I'm comfortable with.
In the style guide, you state "noUnion[]
return annotations"; does that also imply "noOptional[]
return annotations"? The Pythonista modules have some. -