鱼C论坛

 找回密码
 立即注册
查看: 2248|回复: 0

求解一段代码

[复制链接]
发表于 2015-1-6 13:32:21 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
本帖最后由 enjoybt5 于 2015-1-6 14:06 编辑

代码如下:
1
2
3
4
5
6
7
8
def print_lol(the_list,level):
    for each_item in the_list:
        if isinstance(each_item,list):
            print_lol(each_item,level+1)
        else:
            for tab_stop in range(level):
                ptint("\t",end='')
            print(each_item)





并把此代码构建发布后,调用:
import nester

movies = ['the holy grail',1975,'terry jones & terry gilliam',91,
['graham chapman',['michael palin','john cleese',
'terry gilliam','eric idle','terry jones']]]

nester.print_lol(movies,1)   //调用

确报错:
Traceback (most recent call last):
  File "movie.py", line 5, in <module>
    nester.print_lol(movies,1)
TypeError: print_lol() takes 1 positional argument but 2 were given

我明明在函数定义了两个参数,为什么这里说我只定义了一个?
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2026-2-14 07:07

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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