|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
我在做课后题时, 复制小甲鱼 代码, 是可以运行的, 但是当我进行编辑修改时就报错了,说是缩进不对(代码内容没有错误), 我不得不手敲一遍, 然后 好奇的我,把报错的段落复制到记事本上,发现多了组tap
也就是我 编辑时,另起了一行 ,结果给我多带出了组TAB 缩进, 以前 也碰到过,这个是什么原理?
>>> def my_fun1():
x = 5
def my_fun2():
nonlocal x # 为何Ctrl +v 方式过来,会多出一组TAB ? 纳尼? 再复制回来, 多的那组TAP 又不显示了
x *= x
return x
return my_fun2()
SyntaxError: inconsistent use of tabs and spaces in indentation
>>> def my_fun1():
x = 5
def my_fun2():
nonlocal x
SyntaxError: inconsistent use of tabs and spaces in indentation
>>> def my_fun1():
x=5
def my_fun2():
nonlocal x # 这里手敲的也没缩进, 而是显示的 跟前面CTRL +v 的段落一致
|
|