import res=" 300 january 10 20 "print([[x.group(), x.start(), x.end()] for x in re.finditer(r'\S+', s)])
Standard input is empty
[['300', 2, 5], ['january', 12, 19], ['10', 25, 27], ['20', 34, 36]]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!