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.

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


Please Help Members By Posting Answers For Below Questions

Does Python support Multithreading?

954


How does break work in python?

925


Name some python libraries?

877


Differentiate between lists and tuples?

1099


How does numpy arange work?

921


How do I use python idle?

1064


Describe how multithreading is achieved in python?

1085


What does * args mean in python?

977


What is use of @classmethod, @staticmethod, @property in python?

942


How do you override a method in python?

988


What are the advantages of using python?

990


Should I learn python before c?

910


Optionally, what statements can you put under a try-except block?

875


Purpose of "/" and "//" operator in python?

1026


Can we develop a site using python

940