Inferring whether an integer/string is a unix timestamp

时间:2015-10-31 00:09:45

标签: python unix

Let's say I have a list of different integers (either as integers, or as strings), such as: 1,2,100,84,12,109 I know with a fair degree of accuracy that this probably not a unix timestamp series. However, with the following series of numbers, I would estimate that it probably would be: 1446250200, 1446250220, 1446240220 Is there a good way to estimate whether a list of integers is most likely a unix timestamp series? I need to have a function like this for date parsing -- one which guesses whether the field is an integer or a timstamp (and if it guesses incorrectly the user can override that). What would this function look like?

0 个答案:

没有答案