我正在尝试转换一个元组:
('Cobra',)
为字符串,在打印时会产生:
Cobra
答案 0 :(得分:0)
#Assuming you have a list of tuples
sample = [('cobra',),('Cat',),('Dog',),('hello',),('Cobra',)]
#For each tuple in the list, Get the first element of each tuple
x = [i[0] for i in sample]