Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #62663
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <jsf80238@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.042 |
| X-Spam-Evidence | '*H*': 0.92; '*S*': 0.00; 'static': 0.04; 'string.': 0.05; 'table.': 0.07; 'subject:How': 0.10; 'cc:addr:python-list': 0.11; 'fields:': 0.16; 'validation.': 0.16; 'import': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply- To:1': 0.27; 'tried': 0.27; 'message-id:@mail.gmail.com': 0.30; 'file': 0.32; 'subject:the': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'consist': 0.36; 'i.e.': 0.36; 'subject:?': 0.36; 'work?': 0.38; 'sure': 0.39; 'kind': 0.63; 'different': 0.65; 'date,': 0.68; 'skip:r 40': 0.68; 'sole': 0.78; 'subject:check': 0.84; 'to:none': 0.92 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=orraJq4J24xfpYWyHin5F9CFPH3EITbqr53Rw6kbCw8=; b=KTD4PsZ/PdyrOrnGZ9nRUQpbmZPDoyv4/9QaVuPeZpvGM3PD76lb+EjHxU925F1N/K HtvNiRQzM8DQ5Mopg7aGdYTdbM+IQNztH2q+QMOHJyyndqNj49yXXFHtluv0GZw1+gFk 1DK509/9wdb/ghIloWqSM3k9WIs3o9gEh94On/fJkWp7BmhcpAXZSSFZHz4UnBibXviW vVgo0Qu9ghhTFdd54jjhhpH0H7qlVemRp+HZOHnIiFWCTKfwub3+iHxqOj4pvC5qXPBl TpCKQKO04ggv+kc+CR5axB+sHOL+oCUjCaEikRHASomH8TOdxgKyMDIswZvyi9AXZw93 ACqw== |
| MIME-Version | 1.0 |
| X-Received | by 10.50.66.212 with SMTP id h20mr23700156igt.48.1387852795200; Mon, 23 Dec 2013 18:39:55 -0800 (PST) |
| In-Reply-To | <CA+FnnTxf1te0s4fmaXfP1wcCQ8esxrfyx3TN-JKizrMTyL-Lsg@mail.gmail.com> |
| References | <CA+FnnTxf1te0s4fmaXfP1wcCQ8esxrfyx3TN-JKizrMTyL-Lsg@mail.gmail.com> |
| Date | Mon, 23 Dec 2013 19:39:55 -0700 |
| Subject | Re: How to check the date validity? |
| From | Jason Friedman <jsf80238@gmail.com> |
| Cc | python-list <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4583.1387854401.18130.python-list@python.org> (permalink) |
| Lines | 13 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1387854401 news.xs4all.nl 2842 [2001:888:2000:d::a6]:45377 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:62663 |
Show key headers only | View raw
> 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 comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: How to check the date validity? Jason Friedman <jsf80238@gmail.com> - 2013-12-23 19:39 -0700
csiph-web