Python 3.x 转换元组内的列表并添加到元组

Python 3.x 转换元组内的列表并添加到元组,python-3.x,list,tuples,Python 3.x,List,Tuples,如何获取:[('Username','INFO','ERROR'),('ac',2,2),('hello',4,3)] 所以,基本上如何摆脱元组内的列表 或: 如何将其转换为{'ac':[2,2],'hello':[4,3]}或{'ac':(2,2),'hello':(4,3)} 到:[('ac',2,2),('hello',4,3)]查找字典 *v将解压缩值 y={'ac':[2,2],'hello':[4,3]} [(k,*v)表示k,v在y.项中() >>>[('ac',2,2),(

如何获取:
[('Username','INFO','ERROR'),('ac',2,2),('hello',4,3)]

所以,基本上如何摆脱元组内的列表


或:

如何将其转换为
{'ac':[2,2],'hello':[4,3]}
{'ac':(2,2),'hello':(4,3)}

到:
[('ac',2,2),('hello',4,3)]

查找字典
  • *v
    将解压缩
y={'ac':[2,2],'hello':[4,3]}
[(k,*v)表示k,v在y.项中()
>>>[('ac',2,2),('hello',4,3)]
对于元组列表
z=[('Username','INFO','ERROR'),('ac',[2,2]),('hello',[4,3])]
xx=列表()
对于z中的x:
tt=元组()
对于x中的y:
如果不是类型(y)=列表:
tt+=(y,)
其他:
tt+=(*y,)
xx.追加(tt)
xx=[('Username','INFO','ERROR'),('ac',2,2),('hello',4,3)]

嗨,@Trenton这真的帮了我很大的忙,非常感谢。我也为其他人使用了你的for-loop连接版本,它工作起来很有魅力!!真的很感激!
[('Username', 'INFO', 'ERROR'), ('ac', [2, 2]), ('hello', [4,3])]