This is a model of a text file that I want to parse:
Something: different
Date: 22:23:32
I want to get the information after the :, for example: different and 22:23:32.
The only way in which I know how to do it, is to parse each line and split after :. The problem is that in case of date, it will crash.
This is the code I have written up to now:
for line in file:
if re.match("Something", line):
line = line.split(':')
print (str(line[1]))
elif re.match("Date", line):
???
This is just a simple example, the file which I need to parse containing much more information that I need to extract.
Which would be the most efficient way to solve the problem?