> > If you always convert the values back to strings then you could
> > just hold onto the original strings by storing them in a (str, val) tuple.
> > If you do calculations and modify anmy of them then convert the
> > value/string there and then and modify the tuple. You could even
> > make it a
Sander Sweers wrote:
On Tue, Jan 6, 2009 at 04:38, bob gailer wrote:
I also suggest splitting convertValue into two functions, one that takes
strings and one that takes numbers. A lot easier to read and maintain.
FWIW you could dispense with reverse in convertValue by testing the
On Tue, Jan 6, 2009 at 09:46, Alan Gauld wrote:
> If you always convert the values back to strings then you could
> just hold onto the original strings by storing them in a (str, val) tuple.
> If you do calculations and modify anmy of them then convert the
> value/string there and then and modify
On Tue, Jan 6, 2009 at 04:38, bob gailer wrote:
> I also suggest splitting convertValue into two functions, one that takes
> strings and one that takes numbers. A lot easier to read and maintain.
>
> FWIW you could dispense with reverse in convertValue by testing the type of
> value for int or str
"Sander Sweers" wrote
I use the csv module to read and write a csv file. When I read the
file into a new list I convert the ints and the dates to int and
time
When writing the lines back to a csv file I loop over the lists and
convert the values back with the same function but in reverse
Sander Sweers wrote:
Hello Tutors,
I use the csv module to read and write a csv file. When I read the
file into a new list I convert the ints and the dates to int and time
objects so I can do calculations. I use the below function which
works.
def convertValue(value, dateformat, reverse=False):
Hello Tutors,
I use the csv module to read and write a csv file. When I read the
file into a new list I convert the ints and the dates to int and time
objects so I can do calculations. I use the below function which
works.
def convertValue(value, dateformat, reverse=False):
if reverse: