How to remove the date from time data when it is separated by a space?

I have some data in a current .csv file that is space separated then ; separated. I get how to do the sep";" but the problem is the spaces. It looks a little like this:

Time; Age; etc
04-09-2003 17:06:39 ; 29 ; etc

I need to get the date removed so that in "Time" there is only the variable of time (ie. I don’t need the system to look at the date at all as it is rather irrelevant).

How would I go about this? And is it reproducible for around 5000 bits of data?

Many thanks in advance!

>Solution :

after seperating the line with ‘;’, just split each part again after each ‘ ‘.

datetime = "04-09-2003 17:06:39"
parts = datetime.split(' ')
print(parts[1])

Leave a Reply