[EMAIL PROTECTED] wrote:
I have a dictionary.  Each key contains a list.  I am using the
contents of the list to build a portion of a command line.

However, before I can build the command line, I have to make sure that
the command isn't too long.  This means that I have to step through
each item in the list twice: once to check the length and once to build
the command.  Is there an easier/better way to do this?

I'm not exactly sure what is done in "break command portion into multiple portions," but you could always build the command and then check the list.

Or you can get the length of all of the values this way:

sum(len(value) for value in cmdline_dict.itervalues())

I don't think it's a good idea to call your dict "dict" as it shadows a
built-in.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to