Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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.



Write a one-liner that will count the number of capital letters in a file. Your code should work eve..

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

Post New Answer

More Python Interview Questions

Should I learn c++ or python?

0 Answers  


How do I find the current module name?

0 Answers  


What is a singleton python?

0 Answers  


Explain me what is a built-in function that python uses to iterate over a number sequence?

0 Answers  


Which is better c++ or java or python?

0 Answers  


How do I run python on linux?

0 Answers  


What are the differences between pass and continue?

0 Answers  


What does file flush mean?

0 Answers  


How can files be deleted in python?

0 Answers  


How to display the contents of the text file in reverse order?

0 Answers  


How are classes created in python?

0 Answers  


What is scheduling in threading?

0 Answers  


Categories