You can I find a substring between characters I want to find this character svm
?
I looked at Get string between two strings and Find string between two substrings. So this is my string ('svm', SVC())
And I want to find all between ' '
so the result should be svm
or dct_test
import re
dict_SupportVectorMachine = {
"classifier": ('svm', SVC()),
"parameters": {'svm__C':[0.001,0.01,0.1,10, 100],
'svm__gamma':[0.1,0.01],
'svm__kernel':['linear', 'sigmoid']}
}
string = dict_SupportVectorMachine['classifier']
string2 = ('dct_test', ThisCouldbeLongerAndShorter())
subStr = re.findall(r"('(.+?)',",string)
print(subStr)
[OUT]
error: missing ), unterminated subpattern at position 0