How can I replace the contents of strings with #‘s in Python? Assume no comments, no multiple lines for one string. Like if there is a line in a python file:
print 'Hello' + "her mom's shirt".
This will be translated into:
print '#####' + "###############".
It’s like a filter to deal with every line in a python file.
—-Edit
OK, Now I understand that you want the output to be from a Python file. Try:
This does not deal with line breaks, the “”” form, and is only tested again 1 or two files I have…
In general, it is better to use a parser for this kind of job.
Best