This question already has answers here:
Converting a list to a string [duplicate]
                                
                                    (8个答案)
                                
                        
                                2年前关闭。
            
                    
我有一个列表,L1 = ['T51', 'T52']。如何将其转换为T51T52并将其传递给变量?

最佳答案

尝试使用内置的join方法。像这样:

L1 = ['T51', 'T52']
string = " ,".join(L1)

关于python - 如何将列表转换成用逗号分隔的字符串? ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44119612/

10-12 23:31