string objects...

Discussion in 'Python' started by google account, Sep 19, 2003.

  1. I know that string.letters and string.digits are all the letters and
    numbers, is there a string.???? that is a subset of all the ascii
    characters that are available on a US English Keyboard without going
    to special characters (like ß or ¿)

    I couldnt see anything that was explaining this stuff on the
    python.org site.

    I think what I want is soemthing like string.printable -
    string.whitespace but that doesn't seem to work like string.letters +
    string.numbers...


    TIA


    Googleboy
     
    google account, Sep 19, 2003
    #1
    1. Advertising

  2. (google account) writes:

    > I know that string.letters and string.digits are all the letters and
    > numbers, is there a string.???? that is a subset of all the ascii
    > characters that are available on a US English Keyboard without going
    > to special characters (like ß or ¿)
    >
    > I couldnt see anything that was explaining this stuff on the
    > python.org site.
    >
    > I think what I want is soemthing like string.printable -
    > string.whitespace but that doesn't seem to work like string.letters +
    > string.numbers...
    >


    Minus does not work on string, as there is now obvious meaning of
    this: cut from the end, or a set like minus you would be happy this
    time

    You may use list comprehension to filter out all whitespace from
    printable and than join the list with empty separator:

    >>> import string
    >>> ''.join([c for c in string.printable if c not in string.whitespace])

    '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'

    --

    =*= Lukasz Pankowski =*=
     
    Lukasz Pankowski, Sep 19, 2003
    #2
    1. Advertising

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. bigbinc
    Replies:
    3
    Views:
    403
    Michael Borgwardt
    Nov 18, 2003
  2. Simon Elliott

    Inheritance of objects within objects

    Simon Elliott, Dec 10, 2004, in forum: C++
    Replies:
    2
    Views:
    337
    Simon Elliott
    Dec 10, 2004
  3. =?Utf-8?B?c3RldmVuIHNjYWlmZQ==?=

    form objects into class objects

    =?Utf-8?B?c3RldmVuIHNjYWlmZQ==?=, Jul 5, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    437
    =?Utf-8?B?c3RldmVuIHNjYWlmZQ==?=
    Jul 6, 2006
  4. Replies:
    4
    Views:
    591
    Joseph Kesselman
    Aug 10, 2006
  5. 7stud
    Replies:
    11
    Views:
    700
    Dennis Lee Bieber
    Mar 20, 2007
Loading...

Share This Page