python - 名称 Bot 未在 cicle 中定义,而
问题描述
我试图在一个类中创建一个 cicle 以创建一个“无限”循环,当我将“test” istance 与“print”方法相关联时,出现错误“name 'bot' is not defined”。我该如何解决?
这里的代码:
class bot:
while(1):
test = bot()
def print():
print = "Hello"
return print
test = bot()
print(test.print())
感谢您
解决方案
推荐阅读
- c# - 将动态内容插入静态 HTML
- android - Flutter Android 警报管理器:缺少实现
- neo4j - Neo4j OGM - 过滤器组合
- java - maven deploy:deploy-file 失败并出现错误无法部署工件/元数据:无法访问 [url to artifactory]
- anaconda - 我无法提取 tar.gz 文件
- bluetooth-lowenergy - 在华为设备上未收到 requestMtu 的响应
- python - 使用 BS4 和 Regex 从网站上抓取电子邮件地址
- javascript - 如何用 JS 抓取索引?
- node.js - 我应该使用哪个 Node 版本来开发我的包?
- java-8 - Java8:使用 2 BiConsumer 的方法 collect 如何返回一个值作为最终结果?