python - 我没有在我的代码中要求一个参数,但它也说“all() 需要正好 1 个参数,0 给定”,我不知道我应该做什么
问题描述
class alphabet():
def all():
start=str(input('enter the alphabet you want to start with'))
end=str(input('enter the alphabet you want to end with'))``
for j in range (0,25):
if start==chr(65+j):
start=65+j
for k in range(1,25):
if end==chr(65+k):
end=65+k
for i in range (start,end):
print(chr(i))
alphabet(all())
请尽快解决错误我正在尝试创建一个类“alphabets”,其中我定义了一个名为“all”的函数,它将在用户输入时写入字母
解决方案
不要使用all
. 它是一个内置的保留函数是python。重命名它。
见这里。
推荐阅读
- linux - CoW 是否适用于具有相同内容但不是由 `cp --reflink` 创建的文件?
- python - Python - DataFrame 中不同变量的 Yes 和 No 计数的并排条形图
- typescript - Typescript:模板文字,用于定义带有开始标签和一些字符串内容的 html
- dns - 在 Netlify 上添加三级域
- node.js - Azure 上的文件上传
- python - GitPython - 脚本错误 - 已经存在并且不是空目录
- windows - 使用 Docker 文件中的 COPY 将文件夹从 Windows 主机操作系统复制到 Docker 映像中
- wordpress - 使用 wp_query 时分页不起作用?
- installation - 永久存储信息
- python - Scrapy-mongodb 将数据保存在数组数组中,而不是单个数组