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

  • 3
    Just the same read without parameters returns the entire file in one line. - dzhioev pm

1 answer 1

 myList = ['str1', 'str2', 'str3'] myString = ''.join(myList) # '' - разделитель между элементами списка соответственно >>> str1str2str3 myString = '_'.join(myList) >>> str1_str2_str3 
  • 2
    Pep-8 recommends my_list , my_string instead of myList , myString - jfs
  • That's right. Now I am writing this way. - WorldCount