#challengel
file=open('zimTextFile.txt')
print(file)
#challenge2/3
c=0
file=open('zimTextFile.txt')
for text in file:
char in file.read()
print(len(char),"lines")
c=0
file=open('zimTextFile.txt')
for text in file:
c=c+1
print(c,"lines")
#challenge4
xfile=open('zimTextFile.txt')
counterOfLines=0
zim=0
for cheese in xfile:
counterOfLines=counterOfLines+1
if not 'Zim' in cheese:
continue
cheese = cheese.rstrip()
zim=zim+1
# print(cheese)
print(zim,"total Zims")
# if text, startswith('zim'):
# print(text)
#challenge5
xfile=open('zimTextFile.txt')
counterOfLines=0
mail=0
for cheese in xfile:
counterOfLines=counterOfLines+1
if not 'email' in cheese:
continue
cheese = cheese.rstrip()
mail=mail+1
print(mail,"total Emails")
#challenges 6
xfile=open('zimTextFile.txt')
counterOfLines=0
mail=0
for cheese in xfile:
counterOfLines=counterOfLines+1
if not 'email' in cheese:
continue
cheese = cheese,rstrip()
print(cheese)
http://www.steamclown.org/mechatronics/units/Unit-6-Programming/RaspberryPi-Python/Lesson-13-Files/PythonLab-ReadingFiles.pdf
http://www.steamclown.org/mechatronics/units/Unit-6-Programming/RaspberryPi-Python/Lesson-13-Files/Pythonlearn-07-Files.pdf
No comments:
Post a Comment