splitString output as argument to string format fails?

gabriele renzi surrender_it at remove.yahoo.it
Wed Mar 24 19:30:29 CET 2004


il Wed, 24 Mar 2004 18:23:21 GMT, "U-CDK_CHARLES\\Charles" <"Charles
Krug"@cdksystems.com> ha scritto::

>List:
>
>I'm trying to pull comma delimited data from a file, then format for
>display in a listBox.  I'm using string.split()
>
>When I do:
>
>    print string.split(myInputLine, ',')
>
>I get something like:
>
>['Mon Mar 22 09:37:28 2004', ' <cbLogger>', ' -- Log opened
>successfully\n']
>
>But when I attempt something like:
>
>    f = '%s %s %s' % string.split(eachLine, ',')
>
>I get:
>
>TypeError: not enough arguments for format string
>

works like a charm for me :
(s is the string without ',')

>> str='%s, %s, %s'% s
=> "Mon Mar 22 09:37:28 2004,  <cbLogger>,  -- Log
opened\nsuccessfully\\n"
>> "%s %s %s" % str.split(',')
=> "Mon Mar 22 09:37:28 2004   <cbLogger>   -- Log
opened\nsuccessfully\\n"



More information about the Python-list mailing list