[Tutor] Parsing os.popen(command) output

Bill Burns billburns at pennswoods.net
Sun Sep 11 23:23:58 CEST 2005


Bill wrote:
>> So I opted for this
>>
>> wRes = float(data[1].strip(','))
>>
>> which seems to work fine.

Orri wrote:
> You could just do
> 
> wRes = float(data[1][:-1]) (up to the last digit, which would be the comma)

Orri,

Thank you!

I had never used slicing before (until today). I learn something new 
everyday!

Bill


More information about the Tutor mailing list