python – How do I convert a list to a string?


If you open a text file with , a list is returned. Is it possible to somehow convert it from a string to work with it further with regular expressions?


myList = ['str1', 'str2', 'str3']
myString = ''.join(myList) # '' - разделитель между элементами списка соответственно

>>> str1str2str3

myString = '_'.join(myList)

>>> str1_str2_str3
Scroll to Top