On Jun 7, 3:34 am, simon kagwe <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a string "distances = [[1,1,1,1],[2,2,2,2]]". I want to create a
> variable called distances whose value is the list [[1,1,1,1],[2,2,2,2]]. How 
> can
> I go about that? I know I can use setattr, but how do I create the list from 
> the
> string?
>
> Regards,
> Simon

exec("distances = [[1,1,1,1],[2,2,2,2]]")

~Sean

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to