May-10-2018, 01:03 AM
Hi folks
I am new to python world
I recently wrote a little script to process system Verilog file, repair syntax violations, by regular expression matching
fixFileInFileList.py -i inp0 inp1 inp2
the matching strings were inputted in inp1:
('\S+\.h', '\S+\.H')
By the way, I tried square parenthesis also
That should interpreted as two elements list:
What did I do wrong?
Why script functioned differently versus interpreter run, I even uses the same imports with script?
Or a different implementation to do the same thing?
I am new to python world
I recently wrote a little script to process system Verilog file, repair syntax violations, by regular expression matching
fixFileInFileList.py -i inp0 inp1 inp2
the matching strings were inputted in inp1:
('\S+\.h', '\S+\.H')
By the way, I tried square parenthesis also
That should interpreted as two elements list:
>>> excpType1 = ('\S+\.h' '\S+\.H') >>> print(str(len(excpType1))) 12 >>> excpType1 = ('\S+\.h', '\S+\.H') >>> print(str(len(excpType1))) 2But in the program I placed print statement revealed totally unexpected results:
print(excpType1+str(len(excpType1))) print(excpType1) print(excpType1[einx])yielded:
Output:('\S+\.h', '\S+\.H')20
('\S+\.h', '\S+\.H')
(
In case of square parenthesis:
['\S+\.h', '\S+\.H']20
['\S+\.h', '\S+\.H']
[
I am struggling for a few days now, please help,What did I do wrong?
Why script functioned differently versus interpreter run, I even uses the same imports with script?
Or a different implementation to do the same thing?