Advertisement
Guest User

Untitled

a guest
Sep 26th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. import re
  2.  
  3. def only_lower(s):
  4. return filter(lambda x: x.islower(), s)
  5. # Open the file with read only permit
  6. f = open('FAILEDGG', "r")
  7. # use readlines to read all lines in the file
  8. # The variable "lines" is a list containing all lines in the file
  9. num = 1
  10. # use readline() to read the first line
  11. line = f.readline()
  12. # use the read line to read further.
  13. # If the file is not empty keep reading one line
  14. # at a time, till the file is empty
  15. for line_as_list in line < 20:
  16. #while num < 10 and line.islower():
  17. # in python 2+
  18. # print line
  19. # in python 3 print is a builtin function, so
  20. #print(line)
  21.  
  22. only_lower(line).join(line_as_list)
  23. # use realine() to read next line
  24. print only_lower(line)
  25. # print(line.rstrip())
  26. break
  27. # lower_m = re.findall(exp,lower)
  28. f.close()
  29.  
  30.  
  31.  
  32. print only_lower(line)
  33.  
  34.  
  35.  
  36. **** trying to print out only lowercase words in the whole file print and go to the next one
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement