SyntaxError: invalid syntax (on else)
Any help?
import re
words = ['cats', 'cates', 'dog', 'ship']
for l in words:
m = re.search( r'cat..', l)
if m:
print l
else:
print 'none'
SyntaxError: invalid syntax (on else)
Any help?
import re
words = ['cats', 'cates', 'dog', 'ship']
for l in words:
m = re.search( r'cat..', l)
if m:
print l
else:
print 'none'
The identation of 'else' must be exactly the same as the corresponding 'if'
import re
words = ['cats', 'cates', 'dog', 'ship']
for l in words:
m = re.search( r'cat..', l)
if m:
print l
else:
print 'none'
Thank you.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.