Reputation: 76917
I have data in the form of
str = '"A,B,C,Be,F,Sa,Su"' # where str[1]='M' and str[2]=','
I want to find if "mystring" in str:
. where mystring is M, T, W or Th so on.
But, I want specific string only. i.e for if "S" in str:
output should be none. And if "B" in str:
should be only 'B' and not 'Be'
Upvotes: 0
Views: 65
Reputation: 133554
>>> text = '"A,B,C,Be,F,Sa,Su"'
>>> 'A' in text.strip('"').split(',')
True
>>> 'S' in text.strip('"').split(',')
False
Upvotes: 3