Jeremy Sanders wrote:

> Mirco Schmidt wrote:
> 
>> So I gave it a shot:
>> 
>> imported a file like this:
>> 
>> Date (time), Value
>> 30.05.11 00:00, 10.200
>> 30.05.11 00:01, 10.200
>> 30.05.11 00:02, 10.200
>> 30.05.11 00:03, 10.200
>> 30.05.11 00:04, 10.200
>> 30.05.11 00:05, 10.200
>> 30.05.11 00:06, 10.200
>> 30.05.11 00:07, 10.200
>> 30.05.11 00:08, 10.200
>> 30.05.11 00:09, 10.200

Here's a python script to do the conversion. It uses a regular expression to 
match the line and reoutputs them in a different order.


-----------------------------
#!/usr/bin/env python

import re
import sys

for line in sys.stdin:
    p = re.match(r'([0-9]{2})\.([0-9]{2})\.([0-9]{2}) '
                 r'([0-9]{2}):([0-9]{2}), ([0-9.]+)',
                 line)
    d, m, y, h, m, v = p.groups()
    print "20%s-%s-%sT%s:%s:00, %s" % (y, m, d, h, m, v)
------------------------------

You can do
 cnvtdates.py < in.csv > out.csv
to do the conversion. You need to remove any headers for this to work.

Jeremy



_______________________________________________
Veusz-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/veusz-discuss

Répondre à