从列表项创建字符串

0 python

我有一个列表,list = ['foo','bar']现在我想从每个项目创建一个字符串.

每个字符串都被命名为项目,并具有项目的值

foo ='foo'bar ='bar'

谢谢大家,我会用dict代替

Ign*_*ams 9

不要那样做.请改用dict.

strings = dict((x, x) for x in L)
Run Code Online (Sandbox Code Playgroud)