0

I have this datetime 2011-07-02 03:03:32.793

To deal with the millisecond issue with python 2.5 version(mentioned here), I try to truncate it & convert it date time as:

import_transform: 'lambda x: x[:18]'
import_transform: transform.import_date_time('%Y-%m-%d %H:%M:%S')

How can I write these two import_transform in one line?

Community
  • 1
  • 1
asdf_enel_hak
  • 7,474
  • 5
  • 42
  • 84

1 Answers1

1

You can do this by writing a lambda function that does both together:

import-transform: lambda x: transform.import_date_time('%Y-%m-%d %H:%M:%S')(x[:18])

Note the chained function calls - transform.import_date_time returns a function, which you're then calling.

Nick Johnson
  • 100,655
  • 16
  • 128
  • 198