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

How does ternary operator work in python?

875


Why is not__getattr__invoked when attr==’__str__’?

938


What is __ doc __ in python?

797


What is frozen set in python 3?

790


How to retrieve data from a table in mysql database through python code?

832


Difference between python list comprehension vs. Map?

916


Explain about cookies in python?

798


Can you sort a dictionary python?

794


What does the continue do in python?

774


What is decorator in python?

801


How is numpy different from scipy?

848


What does [::-1} do?

773


What are the benefits of using python? What do you understand of pep 8?

828


What is hierarchical inheritance?

835


What are python variables?

838