In [6]:
import re
string = "hellomypythonhispythonourpythonend"
pat = re.compile('.python.')
result = pat.findall(string)
print(result)
In [10]:
import re
string = "hellomypythonhispythonourpythonend"
pat = 'python.'
result = re.sub(pat, 'php', string, 2)
print(result)
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)
In [ ]: