!!
我正试图用一个单列的数据库开展工作,我可以浏览并显示其内容,例如:
q = test.all()
q.filter("adjclose =", "adjclose")
q = db.GqlQuery("SELECT * FROM test")
results = q.fetch(5)
for p in results:
p1 = p.adjclose
print "The value is --> %f" % (p.adjclose)
然而,需要用代谢栏计算历史价值,我无法接手错误。
for c in range(len(p1)-1):
TypeError: object of type float has no len()
这里是我的法典!
for c in range(len(p1)-1):
p1.append(p1[c+1]-p1[c]/p1[c])
p2 = (p1[c+1]-p1[c]/p1[c])
print "the p1 value<--> %f" % (p2)
print "dfd %f" %(p1)
新的到晚上,任何帮助都将受到极大赞赏。
预先感谢
Ray
HERE IS CompLETE CODE
class CalHandler(webapp.RequestHandler):
def get(self):
que = db.GqlQuery("SELECT * from test")
user_list = que.fetch(limit=100)
doRender(
self,
memberscreen2.htm ,
{ user_list : user_list} )
q = test.all()
q.filter("adjclose =", "adjclose")
q = db.GqlQuery("SELECT * FROM test")
results = q.fetch(5)
for p in results:
p1 = p.adjclose
print "The value is --> %f" % (p.adjclose)
for c in range(len(p1)-1):
p1.append(p1[c+1]-p1[c]/p1[c])
print "the p1 value<--> %f" % (p2)
print "dfd %f" %(p1)