In [6]:
import re

string = "hellomypythonhispythonourpythonend"
pat = re.compile('.python.')
result = pat.findall(string)
print(result)


['ypythonh', 'spythono', 'rpythone']

In [10]:
import re

string = "hellomypythonhispythonourpythonend"
pat = 'python.'
result = re.sub(pat, 'php', string, 2)
print(result)


hellomyphpisphpurpythonend

In [20]:
def fab(max):
    n, a, b = 0, 0, 1
    while n < max:
        a, b = b, a+b
        n = n + 1
        
f = fab(5)
print(type(f))
# for n in fab(5):
#     print(n)


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-20-9269b349613a> in <module>()
      6 
      7 f = fab(5)
----> 8 f.__next__()
      9 # for n in fab(5):
     10 #     print(n)

AttributeError: 'NoneType' object has no attribute '__next__'

In [ ]: