Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #62663 > unrolled thread
| Started by | Jason Friedman <jsf80238@gmail.com> |
|---|---|
| First post | 2013-12-23 19:39 -0700 |
| Last post | 2013-12-23 19:39 -0700 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: How to check the date validity? Jason Friedman <jsf80238@gmail.com> - 2013-12-23 19:39 -0700
| From | Jason Friedman <jsf80238@gmail.com> |
|---|---|
| Date | 2013-12-23 19:39 -0700 |
| Subject | Re: How to check the date validity? |
| Message-ID | <mailman.4583.1387854401.18130.python-list@python.org> |
> 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
Back to top | Article view | comp.lang.python
csiph-web