def str2tuple(*str): return str # 字符串轉元組 a='hh' b=str2tuple(a) print(b) #列表轉字符串,前提是列表里是字符串 b=['hello','haha'] c=''.join(b) print(c) #列表轉元祖 list1=[123,22,44,55] t1=tuple(list1) print(t1) #元組轉字符串 t1=('aa','bb','cc') t2=''.join(t1) print(t2) #元組轉列表 t1=('aa','bb','cc') print(list(t1)) print(list(t1[0]))#列表索引為0的字符串分開 #字符串轉列表 a='hello' print(list(a))#一個個分開的字符串 l1=list(str2tuple(a)) print(l1)#一整個字符串