Odd strip behavior

Discussion in 'Python' started by Rodrick Brown, Mar 22, 2012.

  1. #!/usr/bin/python

    def main():

    str1='this is a test'
    str2='t'

    print "".join([ c for c in str1 if c not in str2 ])
    print(str1.strip(str2))

    if __name__ == '__main__':
    main()

    ../remove_str.py
    his is a es
    his is a tes

    Why wasnt the t removed ?
    Sent from my iPhone
     
    Rodrick Brown, Mar 22, 2012
    #1
    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. Elliot M. Rodriguez

    PLEASE HELP = odd TextChanged behavior

    Elliot M. Rodriguez, Oct 21, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    338
    Elliot M. Rodriguez
    Oct 22, 2003
  2. Michael Speer

    Odd behavior with odd code

    Michael Speer, Feb 16, 2007, in forum: C Programming
    Replies:
    33
    Views:
    1,155
    Richard Heathfield
    Feb 18, 2007
  3. Guy Doune

    pretty strange behavior of "strip"

    Guy Doune, Dec 4, 2008, in forum: Python
    Replies:
    0
    Views:
    213
    Guy Doune
    Dec 4, 2008
  4. Aquila
    Replies:
    35
    Views:
    503
    Mathieu Bouchard
    Mar 31, 2005
  5. yelipolok
    Replies:
    4
    Views:
    288
    John W. Krahn
    Jan 27, 2010
Loading...

Share This Page