making all letters Caps/Small Letters

Discussion in 'Python' started by Merrigan, Dec 14, 2007.

  1. Merrigan

    Merrigan Guest

    Hi There,

    I'm sure I have done this before, but cannot remember how, or find out
    how to do it quickly - but is there a way/function/something in python
    to make all the letters of a raw_input() string small/capital letters?

    Thanks!

    -- Merrigan
     
    Merrigan, Dec 14, 2007
    #1
    1. Advertisements

  2. Merrigan

    Peter Otten Guest

    Merrigan wrote:

    > I'm sure I have done this before, but cannot remember how, or find out
    > how to do it quickly - but is there a way/function/something in python
    > to make all the letters of a raw_input() string small/capital letters?


    Typing

    >>> dir("")


    in the interactive interpreter gives you a list of candidates. If you
    think that "title" is a good candidate try it with

    >>> "alpha BETA".title()

    'Alpha Beta'

    Probably not what you want, but there are more.

    Peter
     
    Peter Otten, Dec 14, 2007
    #2
    1. Advertisements

  3. Merrigan

    David Tweet Guest

    >>> "THIS IS A STRING".lower()
    'this is a string'
    >>> "THIS IS A STRING".title()

    'This Is A String'
    >>> "this is a string".upper()

    'THIS IS A STRING'

    You can browse all the string methods by doing
    >>> dir(str)


    On Dec 14, 2007 1:30 AM, Merrigan <> wrote:
    > Hi There,
    >
    > I'm sure I have done this before, but cannot remember how, or find out
    > how to do it quickly - but is there a way/function/something in python
    > to make all the letters of a raw_input() string small/capital letters?
    >
    > Thanks!
    >
    > -- Merrigan
    > --
    > http://mail.python.org/mailman/listinfo/python-list
    >




    --
    -David
     
    David Tweet, Dec 14, 2007
    #3
  4. Merrigan

    Martin Blume Guest

    "Merrigan" schrieb im>
    > I'm sure I have done this before, but cannot remember how,
    > or find out how to do it quickly - but is there a
    > way/function/something in python to make all the letters
    > of a raw_input() string small/capital letters?
    >

    "upper might help".upper()
    "OR LOWER".lower()

    HTH
    Martin
     
    Martin Blume, Dec 14, 2007
    #4
  5. Merrigan

    Chris Guest

    On Dec 14, 11:30 am, Merrigan <> wrote:
    > Hi There,
    >
    > I'm sure I have done this before, but cannot remember how, or find out
    > how to do it quickly - but is there a way/function/something in python
    > to make all the letters of a raw_input() string small/capital letters?
    >
    > Thanks!
    >
    > -- Merrigan


    as it's a string, it supports string functions.
    ..upper()
    ..lower()
     
    Chris, Dec 14, 2007
    #5
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mikael Petterson

    xsl syntax to generate all caps with _

    Mikael Petterson, Sep 10, 2003, in forum: XML
    Replies:
    3
    Views:
    1,004
    Dimitre Novatchev
    Sep 11, 2003
  2. Ben Gun

    small caps

    Ben Gun, Feb 12, 2007, in forum: HTML
    Replies:
    25
    Views:
    1,520
    Bergamot
    Feb 15, 2007
  3. Samuel van Laere

    Capital or small caps

    Samuel van Laere, Jun 13, 2009, in forum: HTML
    Replies:
    4
    Views:
    1,425
    Harlan Messinger
    Jun 14, 2009
  4. Chris G.
    Replies:
    0
    Views:
    166
    Chris G.
    Jul 1, 2008
  5. Venugopal
    Replies:
    11
    Views:
    2,093
    Tassilo v. Parseval
    Nov 5, 2003
Loading...

Share This Page