Does anyone know how to use re.sub in Python with list comprehensions.
Im using the following,
>>> a = ["N","!","1","abc"]
>>> [(re.sub(r'(h|N|!|N|1)', r"'\033[91m'\g<1>'\033[0m'", 'x')) for x in a]
['x', 'x', 'x', 'x']
As you can see Im only getting x returned as the list elements.
Thanks,
for x in a, but you never actually use thexvariable. Is that intentional?