上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 44 下一页
摘要: 字节码bytecode python把源码文件编译成字节码文件,存放在__pycahe子目录内,用.pyc结尾。之后如果不再修改源码文件,运行时则使用*.pyc文件编译成机器码,这样不但运行速度快,而且支持多个操作系统。 字节码,其实就是一种中间代码。 前置知识 在看字节码之前,先要了解一下code 阅读全文
posted @ 2019-12-07 19:02 Mr-chen 阅读(3359) 评论(0) 推荐(0) 编辑
摘要: 第二部分 Data Structure Chapter2 An Array of Sequences Chapter3 Dictionaries and Sets Chapter4 Text versus Bytes An Array of Sequences 本章讨所有的序列包括list,也讨论P 阅读全文
posted @ 2019-12-04 09:39 Mr-chen 阅读(398) 评论(0) 推荐(0) 编辑
摘要: 第一章 Data model ⚠️整本书都是讲解Data model,第一章是一个概述。 ⚠️不适合初学者。因为special method和meta programming技巧只是Python代码的一部分。不是全部。 目标:学习第一章内容。之后是否深入还是先学习一些其他的知识待定。 纸牌的例子 可 阅读全文
posted @ 2019-12-03 10:12 Mr-chen 阅读(813) 评论(0) 推荐(0) 编辑
摘要: Python Scopes and Namespaces 补充:关于作用域和闭包(一种扩展了作用域的函数):参考我的这篇博客https://www.cnblogs.com/chentianwei/p/12028118.html A namespace is a mapping from names 阅读全文
posted @ 2019-12-02 12:26 Mr-chen 阅读(280) 评论(0) 推荐(0) 编辑
摘要: 在Python教程里,针对默认参数,给了一个“重要警告”的例子: def f(a, L=[]): L.append(a) return L print(f(1)) print(f(2)) print(f(3)) 默认值只会执行一次,也没说原因。会打印出结果: [1] [1, 2] [1, 2, 3] 阅读全文
posted @ 2019-11-30 17:43 Mr-chen 阅读(561) 评论(0) 推荐(0) 编辑
摘要: for语句,当可迭代对象耗尽后执行else语句。 while循环,当条件为False后执行else。 a = 1 while a != 10: a += 1 else: print(a) 阅读全文
posted @ 2019-11-30 16:10 Mr-chen 阅读(417) 评论(0) 推荐(0) 编辑
摘要: 加快brew更新速度的方式:用代理 参考: https://www.zhihu.com/question/31360766常用的ss客户端都自带PAC模式的,比如ShadowsocksX-NG。 再次强调,如果你不想折腾的话:),我"个人"完全不推荐Homebrew使用镜像,不管他是中科大还是git 阅读全文
posted @ 2019-11-30 09:47 Mr-chen 阅读(1412) 评论(0) 推荐(0) 编辑
摘要: json 源代码: Lib/json/__init__.py json.dump() import json numbers = [1, 2, 3, 4] with open('linshi.py', 'a') as f_obj: json.dump(numbers, f_obj) 解释: 用ope 阅读全文
posted @ 2019-11-29 21:47 Mr-chen 阅读(443) 评论(0) 推荐(0) 编辑
摘要: 用户输入input() input()函数: 用于从标准输入读取数值。 >>> message = input('tell me :') tell me :hahah >>> message 'hahah' 相关: Unix的内建命令read的功能和Python的input()类似。都是重标准输入读 阅读全文
posted @ 2019-11-29 11:11 Mr-chen 阅读(901) 评论(0) 推荐(0) 编辑
摘要: >>> import this The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Compl 阅读全文
posted @ 2019-11-28 21:33 Mr-chen 阅读(250) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 44 下一页