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
Is javascript easier than python?
How do I run Apache in Python?
How to use *args and **kwargs in python?
What are the packages?
What is lambda function in python?
How would you create an empty numpy array in python?
Explain pickling and unpickling in python?
Are there arrays in python?
How would you convert a string into an int in python?
How will you check if all characters in a string are alphanumeric?
What does the list comprehension do?
Can I make games with python?
What is a lambda function?
Is empty python dataframe?
Can I learn python on my own?