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

Is javascript easier than python?

834


How do I run Apache in Python?

921


How to use *args and **kwargs in python?

981


What are the packages?

793


What is lambda function in python?

834


How would you create an empty numpy array in python?

875


Explain pickling and unpickling in python?

847


Are there arrays in python?

821


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

885


How will you check if all characters in a string are alphanumeric?

867


What does the list comprehension do?

909


Can I make games with python?

808


What is a lambda function?

1626


Is empty python dataframe?

862


Can I learn python on my own?

862