开始学python,编的函数居然不能用汉字注释,网上查了一下,在文件的头2行加入
# -- coding: utf-8 --
就可以了
如下面的函数,运行就不会报错了
# 计算面积的函数
def cal_area( width , height ):
return width*height
OK!
开始学python,编的函数居然不能用汉字注释,网上查了一下,在文件的头2行加入
# -- coding: utf-8 --
就可以了
如下面的函数,运行就不会报错了
# 计算面积的函数
def cal_area( width , height ):
return width*height
OK!