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

Question:

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

Answer:

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

>>> str1str2str3

myString = '_'.join(myList)

>>> str1_str2_str3
Scroll to Top