摘要: The Python Standard Library While The Python Language Reference describes the exact syntax and semantics of the Python language, this library referenc 阅读全文
posted @ 2021-08-26 15:49 emanlee 阅读(87) 评论(0) 推荐(0)
摘要: 在python2.7的doc中,round()的最后写着, "Values are rounded to the closest multiple of 10 to the power minus ndigits; if two multiples are equally close, roundi 阅读全文
posted @ 2021-08-26 14:55 emanlee 阅读(1619) 评论(0) 推荐(0)
摘要: 1.文件分类 源代码:文件以py为扩展名,由python程序解释,不需要编译; *.pyc, py源文件编译成的二进制字节码文件,依然由python加载执行,不过速度会提高,也会隐藏源码; *.pyo,优化编译后的程序,也是二进制文件,适用于嵌入式系统。2 pyc和pyo文件生成 生成pyc文件: 阅读全文
posted @ 2021-08-26 11:04 emanlee 阅读(543) 评论(0) 推荐(0)
摘要: import语句用来导入其他python文件(称为模块module),使用该模块里定义的类、方法或者变量,从而达到代码复用的目的。为了方便说明,我们用实例来说明import的用法,读者朋友可以跟着尝试(尝试时建议使用python3)。 将要建立文件的结构为: Tree |____ m1.py |__ 阅读全文
posted @ 2021-08-26 10:27 emanlee 阅读(2417) 评论(0) 推荐(0)
摘要: Python Symbols ! (exclamation) in a command interpreter in curses module in formatted string literal in glob-style wildcards, [1] in string formatting 阅读全文
posted @ 2021-08-26 09:21 emanlee 阅读(554) 评论(0) 推荐(0)
摘要: python 一行写几条语句一行输入多个语句,用分号隔开print('hello');print('world')一条语句分多行书写一语句多行有两种形式。一种是括号,包括小括号、中括号和大括号。适用于条件判断: (1<2 and 1==3 )这种形式尤其在条件表达式中比较好用,如: level=(' 阅读全文
posted @ 2021-08-26 09:14 emanlee 阅读(3264) 评论(0) 推荐(0)