問題是,在我的筆記本電腦中,我有一些版本的Simplejson和我的Debian 6服務器的Python 2.7.5我有Python 2.6.6一些simplejson版本.. 但什麼發生在Debian的服務器是simplejson是增加額外的精密座標值 -Python simplejson座標問題
>>> import simplejson as json
>>> streamer_data = json.loads('{"text": "test","geo": {"type": "Point","coordinates": [52.68908263, -8.50845340]},"coordinates": {"type": "Point","coordinates": [-8.50845340, 52.68908263]}}');
>>> print streamer_data
{u'text': test', u'geo': {u'type': u'Point', u'coordinates': [52.689082630000001, -8.5084534000000005]}, u'id': 420024061457346560L, u'coordinates': {u'type': u'Point', u'coordinates': [-8.5084534000000005, 52.689082630000001]}}
在我的筆記本電腦這給適當的精度正確的結果座標值 -
>>> print streamer_data
{'text': 'test', 'geo': {'type': 'Point', 'coordinates': [52.68908263, -8.5084534]}, 'coordinates': {'type': 'Point', 'coordinates': [-8.5084534, 52.68908263]}}
這是Simplejson版本問題左右還有其他的方法。另外請注意,我試圖找出debian服務器上的simplejson版本,但沒有成功。
嗯不知道這一點。這可能會有幫助,但它不是simplejson:http://stackoverflow.com/questions/1447287/format-floats-with-standard-json-module – valheru
你的問題沒有問題。 –