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 |
Which is better c or python?
How would you check if MySQLdb is installed?
If you installed a module with pip but it doesn’t import in your idle, what could it possibly be?
Explain about default database with python?
How do I share global variables across modules?
What are the features of python?
What is the best way to get the first five entries of a data frame?
Explain garbage collection in python?
What is the pythonpath variable?
How do I test one variable against multiple values?
What are tuples in python?
What are packages in python which are commonly used explain one ?