tereglow wrote:
cpuSpeed = 'Speed: 10'
What I would like to do is extract the '10' from the string,
and divide that by 1000 twice to get the speed of a processor in MHz.
cpuSpeed = 'Speed: 10'
p = cpuSpeed.split(:)
p
['Speed', ' 10']
p[1]
' 10'
v
Kay Schluehr:
int(cpuSpeed.split(:)[1].strip())
Probably this suffices:
int(cpuSpeed.split(:)[1])
Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
I am a complete newbie to Python and am accustomed to coding in PHP/
Perl/Shell. I am trying to do the following:
I have a string:
cpuSpeed = 'Speed: 10'
What I would like to do is extract the '10' from the string,
and divide that by 1000 twice to get the speed of a
On Jun 12, 9:32 am, tereglow [EMAIL PROTECTED] wrote:
Hello,
I am a complete newbie to Python and am accustomed to coding in PHP/
Perl/Shell. I am trying to do the following:
I have a string:
cpuSpeed = 'Speed: 10'
What I would like to do is extract the '10' from the
On 12 Jun., 16:32, tereglow [EMAIL PROTECTED] wrote:
Hello,
I am a complete newbie to Python and am accustomed to coding in PHP/
Perl/Shell. I am trying to do the following:
I have a string:
cpuSpeed = 'Speed: 10'
What I would like to do is extract the '10' from the
On Jun 12, 10:46 am, Kay Schluehr [EMAIL PROTECTED] wrote:
On 12 Jun., 16:32, tereglow [EMAIL PROTECTED] wrote:
Hello,
I am a complete newbie to Python and am accustomed to coding in PHP/
Perl/Shell. I am trying to do the following:
I have a string:
cpuSpeed = 'Speed: 10'
On 6/12/07, tereglow [EMAIL PROTECTED] wrote:
Basically, I want to come out with 1000 for the above string. Any
help would be appreciated.
Tom
There are any number of techniques you can use to parse out the
integer part of the string -- the most generic is to use the re module
to match
tereglow [EMAIL PROTECTED] wrote:
Hello,
I am a complete newbie to Python and am accustomed to coding in PHP/
Perl/Shell. I am trying to do the following:
I have a string:
cpuSpeed = 'Speed: 10'
What I would like to do is extract the '10' from the string,
and divide