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 |
What is frozen set in python?
Which data type you prefer to implement when deal with seuential data?
What is timestamp in python?
What is the statement that can be used in python if the program requires no action but requires it syntactically?
What are negative indices?
What does echo do python?
What is static in python?
What’s the difference between raw_input() and input() in python3.x?
What is the best python interpreter?
What are the differences in xrange and range?
How will you check if all characters in a string are alphanumeric?
Who created python?