+ -
当前位置:首页 → 问答吧 → Python模糊查找

Python模糊查找

时间:2010-12-09

来源:互联网


Python模糊查找报了一个如下错误:
Traceback (most recent call last):
  File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 511, in __call__
  handler.get(*groups)
  File "C:\Program Files\Google\google_appengine\demos\appmmggoo\photo.py", line 72, in get
  searchType = db.Key(string.atio(searchType))
AttributeError: 'module' object has no attribute 'atio'

查找的方法如下:
class PhotoInfoList(PublicPage):
  def get(self,page):
  searchType = self.request.get('searchType')
  radio = self.request.get('radio')
  findDegree = self.request.get('findDegree')
   
  index=0 if page=="" else int(page)

  if (radio == 'imageId' or radio == ''):
  if (findDegree == '1' or findDegree == ''):
  if (searchType ==''):
  images = methods.getAllImages(index)
  prev,next=methods.getPageing(len(images), index)
  template_value={"images":images[:16],"prev":prev,"next":next,"index":index}
  self.render('html/photoManage/photoInfoList.html', template_value)
  else:
  image = methods.getImage(searchType)
  template_value={"image":image,}
  self.render('html/photoManage/photoInfoList_1.html', template_value)
  elif (findDegree == '2'):
  if (searchType ==''):
  images = methods.getAllImages(index)
  prev,next=methods.getPageing(len(images), index)
  template_value={"images":images[:16],"prev":prev,"next":next,"index":index}
  self.render('html/photoManage/photoInfoList.html', template_value)
  else:
  searchType = db.Key(string.atio(searchType))#这一行报错
  images = Entity.Gql("Where __key__=:1" ,searchType)
  template_value={"images":images,}
  self.render('html/photoManage/photoInfoList.html', template_value)
那里出错了呢?请高手指点!!

作者: xieyingan   发布时间: 2010-12-09

string 没有atio 只能atoi

searchType = db.Key(string.atoi(searchType))

作者: cym64039   发布时间: 2010-12-09

引用 1 楼 cym64039 的回复:
string 没有atio 只能atoi

searchType = db.Key(string.atoi(searchType))
不是这个错误呢,这里的确是写错了!改过来之后还是错!

作者: xieyingan   发布时间: 2010-12-09

认真点。改过来之后还是一样的错吗?

作者: iambic   发布时间: 2010-12-09

引用 3 楼 iambic 的回复:
认真点。改过来之后还是一样的错吗?
还是提示这一行出错,错误的原因还是在这个string.atoi这里!

作者: xieyingan   发布时间: 2010-12-09