Reputation: 161
I am iterating through a string in python and I want to check each character to see if it equals "
. How do I go about doing this?
Upvotes: 5
Views: 28785
Reputation: 98836
Like this:
for c in theString:
if c == '"':
print 'Aha!'
You can also directly get the index of the first quote like so:
theString.index('"')
Upvotes: 11