Suppose I have these strings:
a = "hello"
b = "-hello"
c = "-"
d = "hell-o"
e = " - "
How do I match only the -(String C)? I've tried a if "-" in something but obviously that isn't correct. Could someone please advise?
Let's say we put these strings into a list, looped through and all I wanted to extract was C. How would I do this?
for aa in list1:
if not re.findall('[^-$]'):
print aa
Would that be too messy?