Hi ,
Could anybody help me in fixing this problem.I am getting different results.
O/P is :
['1 THRU 20'] --Which is correct?
O/P is :
['8001', '10828'] --Which is different compare to above one?
The correct Output should be :
['8001 THRU 10828']
Thanks
PSB
Could anybody help me in fixing this problem.I am getting different results.
Code:
Sample1
import re
strLine =' 1 THRU 20
sList = re.findall('\d+ THRU \d+|\d+', strLine)
print sList
['1 THRU 20'] --Which is correct?
Code:
Sample2
import re
strLine =' 8001 THRU 10828 '
sList = re.findall('\d+ THRU \d+|\d+', strLine)
print sList
['8001', '10828'] --Which is different compare to above one?
The correct Output should be :
['8001 THRU 10828']
Thanks
PSB
Comment