python - How to extract data from .txt file that is separated by varying space size? -


i trying extract data (date , time) .txt file, raise 1 second , compare next piece of data can see if date , time continuous.

for example:

15  6 19  9 12 59.0000000   ... other stuff...   15  6 19  9 13  0.0000000 

the problem number of spaces between digits varies (one space if data on right 2 digits, 2 spaces if data on right 1 digit).

how can extract dates, increment 1 second , compare them next date in text without having check every space variation?

you can use string.split() , splits string varying spaces .

and example -

>>> s = "hello  bye          test" >>> s 'hello  bye          test' >>> s.split() ['hello', 'bye', 'test'] 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -