0
我燒瓶代碼:額外的符號
from flask import Flask
from flask.ext.pymongo import MongoClient
conn=MongoClient('127.0.0.1',27017)
app = Flask(__name__)
@app.route("/mongo1")
def find():
dbTest=conn['test']
dbDocs=[]
for fruit in dbTest['fruits'].find():
dbDocs.append(fruit)
return str(dbDocs)
@app.route("/")
def hello():
return "hello world!"
if __name__=="__main__":
app.run()
我在我的瀏覽器輸出是:
[{u'_id': ObjectId('56ea449949b93626b14e2043'), u'name': u'apple'}, {u'_id': ObjectId('56ea444249b93626b14e2040'), u'name': u'apple', u'displayOrder': 1.0}, {u'_id': ObjectId('56ea446549b93626b14e2042'), u'name': u'banana', u'displayOrder': 2.0}, {u'_id': ObjectId('56ea445649b93626b14e2041'), u'name': u'orange', u'displayOrder': 3.0}, {u'_id': ObjectId('56ea7b03fae6cf4cb8d84635'), u'name': u'pinepple'}]
我的問題是爲什麼我收到「U」每一個關鍵前價值對? 忽略這種符號應該怎麼做?
請嘗試在PyPy而不是PyPy3上使用它? –