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 / mahesh
len([c for l in open('foo.txt') for c in l if c.isupper()])
| Is This Answer Correct ? | 0 Yes | 0 No |
Does range start at 0 python?
What applications use python?
What does head () do in python?
Explain try, raise, and finally?
What is a module in python?
How do you perform pattern matching in python? Explain?
What is a numpy array?
Write a program to find out the name of an object in python.
What does the ord() function do in python?
name few python modules for statistical, numerical and scientific computations?
What is operator overloading in python?
What is __ doc __ in python?