python学习之函数自定义
def my_abs(x): if not isinstance(x,(int,float)): raise TypeError(‘bad parameter type’) if x > 0: return x else: return -x 以上函数定义了一个返回绝对值的函数,其中 not isinstance…
阅读全文 »已阅读 659 次def my_abs(x): if not isinstance(x,(int,float)): raise TypeError(‘bad parameter type’) if x > 0: return x else: return -x 以上函数定义了一个返回绝对值的函数,其中 not isinstance…
阅读全文 »已阅读 659 次先写第一个python文件 hello.py print(‘hello world’) 然后运行,当然目录一定切换到文件目录下 localhost:Desktop liuxxx$ ./hello.py 然后输出如下 -bash: ./hello.py: Permission denied 喔,NO,权限权限啊 好吧给h…
阅读全文 »已阅读 1,780 次