[Tutor] [Python-Help] a number and control char stored in a single char.
! (fwd)
Daniel Yoo
dyoo@hkn.eecs.berkeley.edu
Fri, 1 Jun 2001 22:55:39 -0700 (PDT)
---------- Forwarded message ----------
Date: Fri, 1 Jun 2001 22:27:13 -0700 (PDT)
From: kaha aham <wishleshak@yahoo.com>
To: help@python.org
Subject: [Python-Help] a number and control char stored in a single char. !
hello,
I am running & capturing screen output of a command using os.popen
as helped by tuto@python.org ppl. However the value i capture which should
be a number like something like 22345 is displayed as '22345\012'
I need to numerically compare this value later in program.
I tried slicing it to remove the last control char using var[:-1],
on which it prints []. I then trid using len(), it tells size as 1 char.
I tried printing just 1st char using var[0], and it shows '22345\012'
That's baffling me. How can it put all that number and control char in 1 char.
I currently can't post to tutor maillist as I did earlier.
I tried int(var) and it says, object cant be converted to int.
Can you give a hint how do I resolve this and get the numeric out of it.
/psg
---------------------------------
Do You Yahoo!?
Yahoo! Mail Personal Address - Get email at your own domain with Yahoo! Mail.