I am learning the intermediate python.
Suppose there's a string
astring = '[Embodied cognition - Wikipedia](https://en.wikipedia.org/wiki/Embodied_cognition)'
Work with string.punctuation to extract the words
from string import punctuation
for delimiter in punctuation:
if delimiter in astring:
astring = astring.replace(delimiter, ' ')
In [7]: astring
Out[7]: ' Embodied cognition Wikipedia https en wikipedia org wiki Embodied cognition '
I tried with map and it works
In [12]: a = map(astring.replace, punctuation, ' ')
In [14]: list(a)
Out[14]: [' Embodied cognition Wikipedia https en wikipedia org wiki Embodied cognition ']
How can the problem be solved in other advanced techniques?
mapshould be padding your string' 'argument withNone, if I'm reading the docs correctly.python3.6tag immediately. @SilvioMayolo