Entering edit mode
7.3 years ago
a.rex
▴
350
Hello,
I am having troubles writing a python script. Specifically, I have a string of numbers and want to replace the word ''zero'' with the integer 0. I then want to cover this string into float values. I used data.replace, and as such had to put "" around the 0 - if not there is an error as it expects a character buffer object. Am I right in saying that I can strip the "" from the 0 before converting to a float?
for data in inFile: data = data.replace ("zero", "0") data = map(float,data.strip('"')) ValueError: could not convert string to float: s
Many thanks.