Issue
i would like generate the following output from the string "[cid:12d32323232dde]foo foo foo \r\n\r\n\r\n[cid:123fsr3ef234fsdfere]\r\n"
expected output
foo foo foo \r\n\r\n\r\n
Solution
So - remove all [cid:...]
blocks and any newlines/carriage-returns trailing them?
>>> import re
>>> s = "[cid:12d32323232dde]foo foo foo \r\n\r\n\r\n[cid:123fsr3ef234fsdfere]\r\n"
>>> re.sub(r"\[cid:(.+?)\][\r\n]*", "", s)
'foo foo foo \r\n\r\n\r\n'
Answered By - AKX
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.