Sending string var with apply sends all chars as params!???

Bjorn Pettersen BPettersen at NAREX.com
Tue Jun 25 11:31:04 EDT 2002


> From: GimsMail [mailto:elabuschagne at gims.com] 
> 
> [snip]
> 
> My print line debugging string output:
> Formatting value '20020625140609' of type <type 'string' with
> formatter <function TimeFormatter at 00D613F4>
> 
> as you can see, I am sending the string '20020625140609' to 
> the function TimeFormatter.
> 
> The code that does this is:
> print "UCP: Formatting value '%s' of type '%s' with formatter 
> '%s'" %(value, type(value), formatter)
> value = apply(formatter,(str(value)))

apply takes a tuple as its second argument. Try:

  value = apply(formatter, (str(value),))

or even better:

  value = formatter(str(value))

-- bjorn





More information about the Python-list mailing list