I am reading some data from a .tsv file with python using standard method but even though it reads strings somehow my date and time format changes from "4/4/2019 6:28:19 PM" to "4/4/2019 18:28". I am losing seconds and the AM/PM tags.
Using Python3 standard libraries. My data is tab separated like follows;
Col1\tTimeStamp\tCol2 val1\t4/4/2019 6:28:19 PM\tval2 Here is my importData function
def importData(file): f = open(file, 'r', encoding='utf-8') headers, data = f.readline().rstrip('\n').split('\t'), [] for line in f: data += [line.rstrip('\n').split('\t')] f.close() return headers, data Update: When I opened the data with Excel and then applied formatting to the timestamp column, it read just fine. I will look into this further later but so far if anyone else have the same issue this could be a work around or the cause of the issue.
f = open(..), can you show us what is the output ofprint(repr(f.read()))?