Python(PyCharm) Flask运行报错 TypeError: object of type 'int' has no len()

Flask运行报错 TypeError: object of type ‘int’ has no len()

  • 报错描述
    基于Python Flask实现一个普通的注册表单验证字段上传界面,如图Python(PyCharm) Flask运行报错 TypeError: object of type 'int' has no len()
    register.htmlPython(PyCharm) Flask运行报错 TypeError: object of type 'int' has no len()
    form.pyPython(PyCharm) Flask运行报错 TypeError: object of type 'int' has no len()
    app.py
    Python(PyCharm) Flask运行报错 TypeError: object of type 'int' has no len()
    看着没什么问题,但运行起来就报错了
    Python(PyCharm) Flask运行报错 TypeError: object of type 'int' has no len()
  • 解决方法:
    IntegerField改为StringField 问题解决
    Python(PyCharm) Flask运行报错 TypeError: object of type 'int' has no len()
    Python(PyCharm) Flask运行报错 TypeError: object of type 'int' has no len()
  • 解决描述
    查看报错信息:TypeError: object of type ‘int’ has no len() 说明整型不具备判断长度的方法所以 出错,所以定位调用了Length方法的代码,发现只有这两个地方调用
    Python(PyCharm) Flask运行报错 TypeError: object of type 'int' has no len()
    而报错的是int 所以指向IntegerField,但由于检测的是电话号码这一属性,所以直接改成StringField就行,问题解决 ????