SyntaxError: non-default argument follows default argument

后端 未结 3 1850
离开以前
离开以前 2020-12-07 13:05
from os import system
def a(len1,hgt=len1,til,col=0):
    system(\'mode con cols=\'+len1,\'lines=\'+hgt)
    system(\'title\',til)
    system(\'color\',col)

a(64,25         


        
3条回答
  •  再見小時候
    2020-12-07 13:13

    You can't have a non-keyword argument after a keyword argument.

    Make sure you re-arrange your function arguments like so:

    def a(len1,til,hgt=len1,col=0):
        system('mode con cols='+len1,'lines='+hgt)
        system('title',til)
        system('color',col)
    
    a(64,"hi",25,"0b")
    

提交回复
热议问题