passing argument to script

eight02645999 at yahoo.com eight02645999 at yahoo.com
Fri Apr 7 06:28:42 EDT 2006


hi

if i have a string like this

"ABCE-123456  ABC_DEF_Suggest(abc def ghi).txt"

that needs to be passed to a python script
and i wanted to get the words inside the brackets after i passed this
string. I did a re
something like

thestring = sys.argv[1:]
pat = re.compile(r".*\((.*)\)\.txt$")
if pat.search(thestring):
   words = pat.search(thestring).group(1)

but it doesn't return anything for words variable.
When i specifically define the string inside the python script , it
works

thestring = "ABCE-123456  ABC_DEF_Suggest(abc def ghi).txt"

I also tried str(thestring) but also did not work
what is wrong with the argument passing?

thanks




More information about the Python-list mailing list