I would like to keep the same amount of white space in my string but replace 'no' with empty string. Here is my code:
>>> import re
>>> line = ' no command'
>>> line = re.sub('^\s.+no','',line)
>>> line
' command'
Expected output without only 'no' replaced with empty string and the number of white spaces remain:
' command'