Python data analysis practice - use join() to convert a list into a string (with source code and implementation effect)

Realize function

Python data analysis practice - use join () to convert the list into a string

Implementation code

l=['ab','bfff','ffffffff']
s=",".join(l)
print(s)#一个字符串
#将['ab','bfff','ffffffff']转化为('ab','bfff','ffffffff')
cmd = "("
for index, elem in enumerate(l):
    cmd = cmd + f"'{elem}'"
    if index < len(l) - 1:
        cmd += ','
cmd += ')'
print(cmd) #cmd仍然是一个字符串

achieve effect

 During my postgraduate study, I published 5 papers related to SCI data mining. Now a research institute is engaged in scientific research related to data mining. I have a certain knowledge and understanding of data mining. I will combine my own scientific research practice experience to share from time to time about python machine learning and deep learning. , Basic knowledge and cases of data mining.

Committed to only being original, understanding and learning in the simplest way, pay attention to V subscription number: data miscellaneous forum , contact me for more skills and source code.

Guess you like

Origin blog.csdn.net/sinat_41858359/article/details/130186931