xml file with about 2000 (texthere) parenthesis. I need to remove the parenthesis and text within it. I tried but am getting an error :(
import re, sys
fileName = (sys.argv[2])
with open(fileName) as f:
input = f.read()
output = re.sub(r'\(\w*\)', '', input)
print fileName + " cleaned of all parenthesis"
and my error :
Traceback (most recent call last):
File "/Users/eeamesX/work/data-scripts/removeParenFromXml.py", line 4, in <module>
fileName = (sys.argv[2])
IndexError: list index out of range
I changed the (sys.argv[1])...I get no errors but also the parenthesis in my file.xml do not get removed?