13
A
回答
20
l = (('aa', 'bb', 'cc'), 'dd')
l = l[0] + (l[1],)
這會爲你的情況下工作,但是gnibbler's solution是賭注一般情況下。
6
7
>>> tuple(j for i in (('aa', 'bb', 'cc'), 'dd') for j in (i if isinstance(i, tuple) else (i,)))
('aa', 'bb', 'cc', 'dd')
0
就是這樣。
x =(1,2);
y =(3,4);
X + Y
(1,2,3,4)
相關問題
- 1. 如何在python中組合兩個numpy數組元素?
- 2. Python中的Spark使用元組 - 我如何在加入兩個RDD後合併兩個元組
- 3. 在合併兩個列表來一個元組在Python
- 4. 如何在jQuery中合併兩個數組對象元素
- 5. 如何合併Python中的兩個圖?
- 6. Python化的方式來「合併」兩個列表中的元組
- 7. 合併兩個Python中
- 8. 在Python中合併元組列表
- 9. 如何在Python中組合兩個列表中的每個元素?
- 10. 如何空出兩個數組的元素合併兩個數組一起
- 11. 如何合併兩個python迭代器?
- 12. 如何合併兩個直方圖python
- 13. 合併兩個數組中的一個數組(元素需要太多合併)
- 14. 如何合併兩個lxml.objectify元素?
- 15. 如何合併兩個單元的GridView
- 16. PIG如何合併兩組?
- 17. 在Python中合併兩個整數
- 18. 在Python中合併兩個對象
- 19. 在Python中合併兩個表
- 20. 在Python中合併兩個字典
- 21. 在Python中合併兩個數據幀
- 22. 在Python中合併兩個列表
- 23. SparseArray - 如何合併兩個數組
- 24. 如何合併兩個數組的值?
- 25. 如何合併這兩個數組?
- 26. 如何合併兩個數組對象
- 27. 如何合併這兩個數組?
- 28. 如何合併兩個數組codeigniter
- 29. 如何合併兩個數組與PHP
- 30. 在nodejs中合併兩個數組
看到http://stackoverflow.com/q/2158395/989121爲更一般的解決方案 – georg