#!/usr/bin/env python
import sys
import re
# regular expressions
pattern = re.compile("[a-zA-Z]*",
re.MULTILINE | re.DOTALL | re.IGNORECASE)
# Read pairs as lines of input from STDIN
for line in sys.stdin:
# loop through every word that matches the pattern
for word in pattern.findall(line):
while i < 1:
if len(converted_word) != WINDOW:
# print "word =", word
if a_to_f_pattern.match(word[i]):
.....
else:
.....
i = 0
this line here
if a_to_f_pattern.match(word[i]):
gives me the error in title and i cannot figure out why
previously, i had while i < len(word) and it worked but now because i want to only check the first letter of each word it does not work.
any clues?
print wordto your loop.*means zero or more of whatever matches the preceding expression, so it will match zero letters. Use+instead to match at least 1.