吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 2724|回复: 8
收起左侧

[已解决] python总是显示name 'question' is not defined

[复制链接]
ymhld 发表于 2020-1-3 19:20
运行总显示name 'question' is not defined

把代码放进survey.py里,显示name 'responses' is not defined
请大佬帮着看看,是哪里出错了,找了半天也没找到

https://www.lanzouj.com/i8fnt6b

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

1170 发表于 2020-1-3 19:42
[Python] 纯文本查看 复制代码
def show_question(self):
		"""显示调查问卷""" 
		print(self.question)
这里是self.question
bluerabbit 发表于 2020-1-3 19:43
        def show_question(self):
                """显示调查问卷"""
                print(question)          -- self.question

        def show_results(self):
                """显示收集到的所有答卷"""
                print("Survey results:")
                for response in responses:   -- self.responses
                        print('- '+ response)
 楼主| ymhld 发表于 2020-1-3 19:43
1170 发表于 2020-1-3 19:42
[mw_shl_code=python,true]def show_question(self):
                """显示调查问卷"""
                print(self.question)

我改一下试试
 楼主| ymhld 发表于 2020-1-3 19:45
1170 发表于 2020-1-3 19:42
[mw_shl_code=python,true]def show_question(self):
                """显示调查问卷"""
                print(self.question)

真是,照着书打的也有错,嗨
 楼主| ymhld 发表于 2020-1-3 19:46
bluerabbit 发表于 2020-1-3 19:43
def show_question(self):
                """显示调查问卷"""
                print(question)          -- self.question

谢谢,真是这里的问题,整了两天了,也没找到错,这回好了
 楼主| ymhld 发表于 2020-1-3 19:46
怎么弄成已解决呢?
IT无名 发表于 2020-1-3 20:42
ymhld 发表于 2020-1-3 19:46
怎么弄成已解决呢?

没办法,发的不是悬赏贴
 楼主| ymhld 发表于 2020-1-3 20:43
IT无名 发表于 2020-1-3 20:42
没办法,发的不是悬赏贴

我看求助区里不少都变成已解决了,不知道怎么弄的?
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止回复与主题无关非技术内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-5-29 15:04

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表