Iterate Through a Callable Iterator

I am working on this program in Python that would allow me to scan for a certain phrase in a certain text document. I used the finditer function in Python's re library.The certain line of code resembled the following:

phrase=regex.finditer(page)

I also had a print statement at the end that read:

print(phrase)

When I did this I got the following results:

<callable_iterator object at 0x02CF8FB0>

This is obviously not the result I want. So I tried replacing finditer with findall:

phrase=regex.findall(page)

For this the result that was printed it was:

With far more 'r's than displayed here. In the end I am trying to find a way to display all the times that that phrase occurs, individually. It would be great if this program can work anything that involves extracting phrases from text.

*NOTE*

I am a fourteen year-old novice not a computer science major, so please be careful with the explanations that you use.

Apparently, your regular expression is matching just 'r'. I base this on the results of your findall attempt.

finditer returns a match object, not just a substring. You need to use ghe group() method on the match object.

Here is a program that works as you might expect:

import re
import sys
# use this to avoid spelling out the vowels and consonants every time
alphabet = {
'v': 'aeiou',
'c':'bcdfghjklmnpqrstvwxyz',
}
# String formatting:
# http://docs.python.org/library/stdtypes.html#string-formatting
p = re.compile("[%(v)s][%(c)s]+[%(v)s]"%alphabet)
print('The pattern is "%s"'%(p.pattern))
# the with statement is a cool shortcut for try:...except:...finally:...
with open(sys.argv[0],'r') as f:
page = f.read()
print("First, look at hits using finditer")
for hit in p.finditer(page):
print(hit.group())
print("Now, look at result of findall")
print(p.findall(page))

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...

Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...