我有一个帐户列表:list1 = ['1234','3456','2345','5543','1344','5679','6433','3243','0089']我需要的输出是一个字符串:print(output):'1234','3456','2345','5543','1344','5679','6433','3243','0089'
2 回答
慕娘9325324
TA贡献1783条经验 获得超4个赞
您可以将所有值与字符串联接,然后在字符串之前和之后添加一个,如下所示:','
'
"'{0}'".format("','".join(list1))
慕尼黑5688855
TA贡献1848条经验 获得超2个赞
>>> list1 = ['1234','3456','2345','5543','1344','5679','6433','3243','0089']
>>> print(','.join(["'{0}'".format(s) for s in list1]))
'1234','3456','2345','5543','1344','5679','6433','3243','0089'
添加回答
举报
0/150
提交
取消