python+函数注释
狄枯健4351Python如何进行中文注释 -
黄省逸15742438300 ______ #在Python中显示中文注释和输出中文 a ="中文" print a d:\Python27\python.exe "D:\test\中文.py" Process started >>> File "D:\test\中文.py", line 1 SyntaxError: Non-ASCII character '\xe5' in file D:\test\中文.py on line 1, but no encoding ...
狄枯健4351Python语言中,外部模块先导入,再使用 - 上学吧普法考试
黄省逸15742438300 ______ 后面paraTestList(a[2:])中,括号里面的a[2:]命令是指创建了一个包含列表a的一部分的一个副本列表.具体做法是: def paraTestList(L): L[0]='z' a=['a','b','c','d'] b=a[2:] paraTestList(b) print(b) 具体情况如下: 1.Python的函数定义简单但灵活度大...
狄枯健4351用python写一个程序 -
黄省逸15742438300 ______ 其实这个不难,以下代码做个参考吧.#-*-coding:utf-8-*- class Student(object): """ 自定义Student类 """ def __init__(self, name, score): # 初始化Student,参数name,score self.name = name self.score = score def __cmp__(self, other):...