Convert Str to Float after reading from File

Peter O'Reilly <[email protected]>
Newsgroups gmane.comp.lang.jython.user
Message-ID <[email protected]>
I am reading from a file and convert a columns from a list value to a string.
Then I try and convert from a str to a float, but get this error.
     x=float(Amount)
ValueError: invalid literal for __float__: 

If I copy the value from the file and assign it to the str variable(Amount), the float function works as expected.
 It seems like it might be some type of encoding issue, anyone else have a  similar problem?  This is the code.

      while (lsrc):
        valueList = lsrc.split(';') 
        ltrg = ';'.join(valueList[12:13])
        x=ltrg.strip().split('\r\n')
        Amount=x[0]
        x=float(Amount)

Thanks,
PR

------------------------------------------------------------------------------

_______________________________________________
Jython-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jython-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.