Re: [Tutor] Problem Stripping

2012-04-02 Thread Steven D'Aprano
Please keep your reply on the list, unless you have something private to say. That way others can help, or learn from your questions. I've taken the liberty of putting this back into the list. Leam Hall wrote: On 04/01/2012 09:40 PM, Steven D'Aprano wrote: leam hall wrote: Python 2.4.3 on R

Re: [Tutor] Problem Stripping

2012-04-01 Thread Steven D'Aprano
leam hall wrote: Python 2.4.3 on Red Hat 5. Trying to use strip to remove characters but it doesn't seem to work like I thought. res = subprocess.Popen(['uname', '-a'], stdout=subprocess.PIPE) uname = res.stdout.read().strip() For future reference, you should identify the shortest possible am

Re: [Tutor] Problem Stripping

2012-03-31 Thread Mark Lawrence
On 31/03/2012 03:01, bob gailer wrote: Then, of course, there's "15:45".replace(':','') For the record in earlier Python versions such as the one the OP is using you can do >>> allchars = "".join([chr(x) for x in range(256)]) >>> 'www.example.com'.translate(allchars, 'cmowz.') 'exaple' As

Re: [Tutor] Problem Stripping

2012-03-30 Thread bob gailer
Then, of course, there's "15:45".replace(':','') -- Bob Gailer 919-636-4239 Chapel Hill NC ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Problem Stripping

2012-03-30 Thread Mark Lawrence
On 30/03/2012 18:28, Joel Goldstick wrote: On Fri, Mar 30, 2012 at 1:25 PM, Joel Goldstick wrote: On Fri, Mar 30, 2012 at 1:09 PM, leam hall wrote: Python 2.4.3 on Red Hat 5. Trying to use strip to remove characters but it doesn't seem to work like I thought. res = subprocess.Popen(['uname

Re: [Tutor] Problem Stripping

2012-03-30 Thread Prasad, Ramit
> strip(...) > S.strip([chars]) -> string or unicode > > Return a copy of the string S with leading and trailing > whitespace removed. > If chars is given and not None, remove characters in chars instead. > If chars is unicode, S will be converted to unicode before strippi

Re: [Tutor] Problem Stripping

2012-03-30 Thread Mark Lawrence
On 30/03/2012 18:09, leam hall wrote: Python 2.4.3 on Red Hat 5. Trying to use strip to remove characters but it doesn't seem to work like I thought. What do you expect it to do? res = subprocess.Popen(['uname', '-a'], stdout=subprocess.PIPE) uname = res.stdout.read().strip() uname 'Linu

Re: [Tutor] Problem Stripping

2012-03-30 Thread Joel Goldstick
On Fri, Mar 30, 2012 at 1:25 PM, Joel Goldstick wrote: > On Fri, Mar 30, 2012 at 1:09 PM, leam hall wrote: >> Python 2.4.3 on Red Hat 5. Trying to use strip to remove characters >> but it doesn't seem to work like I thought. >> >> >> res = subprocess.Popen(['uname', '-a'], stdout=subprocess.PIPE)

Re: [Tutor] Problem Stripping

2012-03-30 Thread Emile van Sebille
On 3/30/2012 10:09 AM leam hall said... Python 2.4.3 on Red Hat 5. Trying to use strip to remove characters but it doesn't seem to work like I thought. ... but it works as advertised... Help on built-in function strip: strip(...) S.strip([chars]) -> string or unicode Return a copy o

Re: [Tutor] Problem Stripping

2012-03-30 Thread Prasad, Ramit
> Python 2.4.3 on Red Hat 5. Trying to use strip to remove characters > but it doesn't seem to work like I thought. > > > res = subprocess.Popen(['uname', '-a'], stdout=subprocess.PIPE) > uname = res.stdout.read().strip() > > >>> uname > 'Linux myserver 2.6.18-274.el5PAE #1 SMP Fri Jul 8 17:59:

Re: [Tutor] Problem Stripping

2012-03-30 Thread Joel Goldstick
On Fri, Mar 30, 2012 at 1:09 PM, leam hall wrote: > Python 2.4.3 on Red Hat 5. Trying to use strip to remove characters > but it doesn't seem to work like I thought. > > > res = subprocess.Popen(['uname', '-a'], stdout=subprocess.PIPE) > uname = res.stdout.read().strip() > uname > 'Linux myse

Re: [Tutor] Problem Stripping

2012-03-30 Thread Evert Rol
> Python 2.4.3 on Red Hat 5. Trying to use strip to remove characters > but it doesn't seem to work like I thought. > > > res = subprocess.Popen(['uname', '-a'], stdout=subprocess.PIPE) > uname = res.stdout.read().strip() > uname > 'Linux myserver 2.6.18-274.el5PAE #1 SMP Fri Jul 8 17:59:09

[Tutor] Problem Stripping

2012-03-30 Thread leam hall
Python 2.4.3 on Red Hat 5. Trying to use strip to remove characters but it doesn't seem to work like I thought. res = subprocess.Popen(['uname', '-a'], stdout=subprocess.PIPE) uname = res.stdout.read().strip() >>> uname 'Linux myserver 2.6.18-274.el5PAE #1 SMP Fri Jul 8 17:59:09 EDT 2011 i686 i6