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
How do I create a variable number of variables?
What is the dictionary in Python?
Do while loops python?
Explain the use of decorators?
Explain python’s parameter-passing mechanism?
Can I make games with python?
How to get class name of an instance in Python?
What is n in python?
What will be the output of ['!!welcome!!']*2?
Is nan in python pandas?
How to install python and prepare environment?
Explain how can you make a Python Script executable on Unix?
What is the difference between old style and new style classes in python?
How to write a text from from another text file in python ?
Explain the interpretation in python?