Help please, why doesn't it show the next input?

Prasad, Ramit ramit.prasad at jpmorgan.com.dmarc.invalid
Wed Sep 11 15:58:27 EDT 2013


William Bryant wrote:
> Sent: Wednesday, September 11, 2013 2:32 PM
> To: python-list at python.org
> Subject: Re: Help please, why doesn't it show the next input?
> 
> @Dave Angel
> 
> What is .lower() ?

Thanks for bottom posting and trimming, but you should
leave some content quoted for context. Otherwise
people will not what you are referring to.

You can find answers to questions like this in the API.
http://docs.python.org/2/library/stdtypes.html#str.lower

I would recommend taking time to get familiar with the
Athena interpreter. It can also answer questions like
this (but with less detail than the web API).

You can use dir() to find the attributes on any object.
help() will give you docstring for the attribute/class.

>>> 'A'.lower()
'a'
>>> help(''.lower)
Help on built-in function lower:

lower(...)
    S.lower() -> string
    
    Return a copy of the string S converted to lowercase.

>>> help(dir)
Help on built-in function dir in module __builtin__:
dir(...)
    dir([object]) -> list of strings
    
    If called without an argument, return the names in the current scope.
    Else, return an alphabetized list of names comprising (some of) the attributes
    of the given object, and of attributes reachable from it.
    If the object supplies a method named __dir__, it will be used; otherwise
    the default dir() logic is used and returns:
      for a module object: the module's attributes.
      for a class object:  its attributes, and recursively the attributes
        of its bases.
      for any other object: its attributes, its class's attributes, and

        recursively the attributes of its class's base classes.
>>> dir('')
['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem_\
_', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__\
', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclass\
hook__', '_formatter_field_name_split', '_formatter_parser', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expan\
dtabs', 'find', 'format', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lo\
wer', 'lstrip', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'starts\
with', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']

If you want to see all the relevant information you can use help()
on the class [e.g. help(str)]. I think help(class) will not show
functions that start with _ unless they are python magic dunder 
functions (e.g. __str__).



~Ramit



This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email.  



More information about the Python-list mailing list