Zenpython Handson1
Zenpython Handson1
PDH Try1
========================================================================
=====================================
fp = io.StringIO(zenPython)
return(fp)
======================
import sys
import os
import io
lst = list()
fp = io.StringIO(zenPython)
zenlines = fp.readlines()
zenlines = zenlines[:4]
print (zenlines)
return(zenlines)
==========================================
data = []
portion = []
for line in newzen:
if(line.find("--") != -1):
data = line.split("--")
if(len(data) == 3):
portion.append(data[1].strip(' '))
if(line.find("*") != -1):
data = line.split("*")
if(len(data) == 3):
portion.append(data[1].strip(' '))
return (portion)
========================================================================
PDH Try2
========================================================================
# Complete the function below.
def subst(pattern, replace_str, string):
#susbstitute pattern and return it
return re.sub(pattern,replace_str,string)
def main():
addr = ['100 NORTH MAIN ROAD',
'100 BROAD ROAD APT.',
'SAROJINI DEVI ROAD',
'BROAD AVENUE ROAD']