Write a one-liner that will count the number of capital letters in a file. Your code should work even if the file is too big to fit in memory.
Answer Posted / mahesh
len([c for l in open('foo.txt') for c in l if c.isupper()])
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Does Python support Multithreading?
How does break work in python?
Name some python libraries?
Differentiate between lists and tuples?
How does numpy arange work?
How do I use python idle?
Describe how multithreading is achieved in python?
What does * args mean in python?
What is use of @classmethod, @staticmethod, @property in python?
How do you override a method in python?
What are the advantages of using python?
Should I learn python before c?
Optionally, what statements can you put under a try-except block?
Purpose of "/" and "//" operator in python?
Can we develop a site using python