“int"对象没有属性“strip"错误消息 [英] 'int' object has no attribute 'strip' error message

查看:291
本文介绍了“int"对象没有属性“strip"错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的程序,这个错误是什么意思?

This is my program and what means this error?

def menuAdiciona():
    nome = input("Digite o nome de quem fez o cafe: ")
    nota = int(input("Que nota recebeu: "))

    if len(nome.strip()) == 0:
        menuAdiciona()

    if len(nota.strip()) == 0:
        menuAdiciona()

    if nota < 0:
        nota = 0

AttributeError: 'int' 对象没有属性 'strip'.

推荐答案

您正在尝试对 nota 值调用 strip(),该值是一个整数.不要那样做.

You are trying to call strip() on the nota value, which is an integer. Don't do that.

这篇关于“int"对象没有属性“strip"错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆