【问题标题】:input expected at most 1 argument, got 4输入预期最多 1 个参数,得到 4 个
【发布时间】:2022-11-17 21:52:01
【问题描述】:
read_def notes():
    With open("notes.txt","r",encoding="utf-8") as file:
        for the line in the file:
            print(file)
enter_def notes():
    name = login("")
    last name = login("")
    note1 = input("note 1: ")
    note2 = input("note 2:")
    note3 = input("note 3: ")
    With open("notes.txt","a",encoding="utf-8") as file:
        file.write(name+' '+surname+ ':'+note1+','+note2+','+note3+'\n')
def note_kayit_et():
    to go past
    
True while:
    action = input("1- Read notes","2- Enter notes","3- Save notes","4- Exit")

    if operation == "1":
        read note()
    elif action == "2":
        enter_notes()
    elif action == "3":
        note_record_et()
    other:
        to break

错误:“最多输入 1 个参数,得到 4 个”

我不明白问题出在哪里。

【问题讨论】:

  • 您应该包括堆栈跟踪和一些额外的上下文,以便其他人更快地帮助您。
  • read_def notes(): 应该是什么?什么是enter_def notes():?什么是True while:?你的代码被改组了吗?
  • 请分享您实际运行的代码和错误消息的完整跟踪。如果您正在运行您共享的代码,那么您就是在 Python 之上运行某些东西,您也应该将其明确化,但这似乎更有可能不是您正在运行的实际代码。

标签: python python-3.x


【解决方案1】:

这是我使用翻译时发生的事情,这实际上是我的代码

def notlari_oku():
with open("notlar.txt","r",encoding= "utf-8") as file:
    for satir in file:
        print(file)
def notlari_gir():
ad = input("")
soyad = input("")
not1 = input("not 1: ")
not2 = input("not 2:")
not3 = input("not 3: ") 
with open("notlar.txt","a",encoding= "utf-8") as file:
    file.write(ad+' '+soyad+ ':'+not1+','+not2+','+not3+'
')
def notlari_kayitet():
pass
while True:
islem = input("1- Notları oku","2- Notları gir","3- Notları kayıt et","4- Çıkış")

if islem == "1":
    notlari_oku()
elif islem == "2":
    notlari_gir()   
elif islem == "3":
    notlari_kayitet()
else:
    break

【讨论】:

  • 不要添加更新作为答案。 Edit 你原来的问题。而且缩进看起来仍然不对。
猜你喜欢
  • 2014-08-01
  • 2020-02-08
  • 1970-01-01
  • 2012-04-15
  • 1970-01-01
  • 2021-11-08
  • 2020-11-07
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多