Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def replace_chars(stringa, listb):
- '''A function to return stringa by removing the list of characters from listb'''
- for x in listb:
- stringa = stringa.replace(x, ' ')
- return stringa
- if __name__ == "__main__":
- import test
- test.testEqual(replace_chars(" SamplEam*",["p", "E", "*"]), " Sam l am ")
- import myfunctions
- import string
- def main():
- punc = list(string.punctuation)
- punc.remove(''')
- filename = input('Enter file name to read: ')
- num = 1
- with open( filename ) as z:
- for a in z.fileread:
- a = a.lower()
- a = a.rstrip()
- a = lstrip()
- a = myfunctions.replace_chars(a,punc)
- print("{0}:{1}".format(count,line))
- num += 1
- main()
- AttributeError: '_io.TextIOWrapper' object has no attribute 'fileread'
- 9:grandson mom can't you tell him i'm sick
- 10:mother you're sick that's why he's here
Add Comment
Please, Sign In to add comment