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

How do I convert a list to a string?

Author

Date

Category

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 1, authority 100%

myList = ['str1', 'str2', 'str3']
myString = '' .join (myList) # '' - separator between list items, respectively
& gt; & gt; & gt; str1str2str3
myString = '_'. join (myList)
& gt; & gt; & gt; str1_str2_str3

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions