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?
- 3Just the same read without parameters returns the entire file in one line. - dzhioev pm
|
1 answer
myList = ['str1', 'str2', 'str3'] myString = ''.join(myList) # '' - разделитель между элементами списка соответственно >>> str1str2str3 myString = '_'.join(myList) >>> str1_str2_str3 - 2Pep-8 recommends
my_list,my_stringinstead ofmyList,myString- jfs - That's right. Now I am writing this way. - WorldCount
|