> In this file I have 3 different kind of fields: one consist of the > sole date, one - sole time and one - datetime. The time includes > milliseconds, i.e. "12:55:55.705" > All fields of the file including those 3 I am reading as the string. > All those strings after validating will go into mySQL table.
> I tried to do an RE, but its static validation and so will not work in > all cases. Not sure what you mean by static validation. Would this not work? import re if re.search(r"\d{1,2}:\d{2}:\d{2}(.\d{1,3})?", "12:55:55.705"): # It's a time -- https://mail.python.org/mailman/listinfo/python-list