Hi, Regualar expression substitution does not work for below code. Want to replace whole word ‘mall’ that occurs at the starting of the line with ‘1234’. Any help.
import re
para = ‘’‘ball fall wall tall
mall call ball pall
wall mall ball fall
mallet wallet malls’’’
and you will start to understand. The \b in your pattern is a backspace in Python’s string literal notation. What you want re to see is literally two characters, a \ and a b. So you need an extra backslash: