[英]Remove single quotes from each item in python list
What is the best way to remove single quotes in a python list?在 python 列表中删除单引号的最佳方法是什么?
I have the following input:我有以下输入:
['"A","B","C",False,False',
'"A","B","C",False,False',
'"A","B","C",False,False']
But i want the following output:但我想要以下 output:
["A","B","C",False,False,
"A","B","C",False,False,
"A","B","C",False,False]
Your function (modified):您的 function(修改):
def f1(database, table, lst):
print(" processing mapping list...")
rows = []
for i in range(len(lst)):
sublist = []
sublist.append(database)
sublist.append(table)
sublist.append(lst[i][0].split(':')[0])
sublist.append(lst[i][1]["a"])
sublist.append(lst[i][1]["b"])
rows.append(sublist)
rows = [item for subl in rows for item in subl]
rows = json.dumps(rows)
return rows
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.