我正在尝试连接2个unicode字符串,但是我收到错误。
代码:
@app.route('/', methods = ['GET','POST'])
def index():
form = forms.MyForm()
rtv = []
text = u''
if request.method == 'POST':
lat = form.latitude.data
lng = form.longitude.data
rds = form.radio.data
sql = text("select place, tweet_id, tweet_text from tweets where ST_DistanceSphere(geom, ST_MakePoint(" + lng + ","+ lat +")) <= "+ rds +" * 1609.344 * 0.62137;")
result = db.engine.execute(sql)
for row in result:
text = text+row[2] #row[2] is a unicode string
rtv.append([row[0],row[1],row[2]])
print text
return render_template('base.html', form = form, rtv = rtv, text = text)
答案 0 :(得分:1)
您在声明text = u''
之前定义sql = text("...")
。所以例外是'unicode' object is not callable
。