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

Which version of python is best?

882


What is set when we have to use?

900


Whenever python exits, why isn’t all the memory de-allocated?

930


Why python is popular now?

838


Is python client or server side?

797


What ide to use for python?

800


How do I use strftime in python?

938


What happens if an error occurs that is not handled in the except block?

848


How would you convert a string into an int in python?

903


How will you get a titlecased version of string?

835


What is an abstract class in python?

913


What are decorators in python and how do you use them?

875


How do I know my python version?

975


What is the mro in python?

989


How to overload constructors or methods in python?

923