[issue7919] reading scientific notation using d instead of e on max osx

Mark Dickinson report at bugs.python.org
Fri Feb 12 21:49:35 CET 2010


Mark Dickinson <dickinsm at gmail.com> added the comment:

> I would rather not do a search and replace every time before reading in > the data.

There's no need to do a search and replace *before* reading the data:  read the data first, then have Python do the replace for you before passing each string to float:

>>> t = string.maketrans('d', 'e')
>>> '-14.235d+03'.translate(t)
'-14.235e+03'

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7919>
_______________________________________


More information about the Python-bugs-list mailing list