楼主: 充实每一天
3635 68

20180227【充实计划】第631期   [推广有奖]

21
scucook103 发表于 2018-2-27 09:05:32 |只看作者 |坛友微信交流群
昨日阅读时间1小时,累计阅读时间44小时。
已有 1 人评分论坛币 收起 理由
充实每一天 + 10 精彩帖子

总评分: 论坛币 + 10   查看全部评分

使用道具

22
arst4 发表于 2018-2-27 09:11:57 |只看作者 |坛友微信交流群
昨日阅读1小时,累计阅读20小时
已有 1 人评分论坛币 收起 理由
充实每一天 + 10 精彩帖子

总评分: 论坛币 + 10   查看全部评分

使用道具

23
情深深 发表于 2018-2-27 09:12:51 |只看作者 |坛友微信交流群
昨天阅读1小时,总计阅读344小时
已有 1 人评分论坛币 收起 理由
充实每一天 + 10 精彩帖子

总评分: 论坛币 + 10   查看全部评分

使用道具

24
kaixin1201 发表于 2018-2-27 09:14:10 来自手机 |只看作者 |坛友微信交流群
充实每一天 发表于 2018-2-27 05:37
【加入充实计划】【了解充实计划】

|新充实挑战|
昨日阅读2小时,累积阅读68小时
已有 1 人评分论坛币 收起 理由
充实每一天 + 10 精彩帖子

总评分: 论坛币 + 10   查看全部评分

使用道具

25
左风右雨 发表于 2018-2-27 09:14:10 |只看作者 |坛友微信交流群
昨天阅读0.5小时,累计阅读258小时。
已有 1 人评分论坛币 收起 理由
充实每一天 + 10 精彩帖子

总评分: 论坛币 + 10   查看全部评分

使用道具

26
守候烟雨 发表于 2018-2-27 09:17:38 |只看作者 |坛友微信交流群
昨日阅读0.5小时,累计阅读195小时
已有 1 人评分论坛币 收起 理由
充实每一天 + 10 精彩帖子

总评分: 论坛币 + 10   查看全部评分

使用道具

27
ccwwccww 发表于 2018-2-27 09:36:52 |只看作者 |坛友微信交流群
昨天阅读时间1小时,累计641小时
已有 1 人评分论坛币 收起 理由
充实每一天 + 10 精彩帖子

总评分: 论坛币 + 10   查看全部评分

使用道具

28
GKINGLIU 在职认证  发表于 2018-2-27 09:42:08 |只看作者 |坛友微信交流群
第二十七天

1.主题:专题强化
Modules + O/i + Erros and Exceptions + Class

2.摘要
模块导入要分别对待,不能用from … import *这种全部导入的方式,要考虑内存的占用与代码的运行速度,只导入包的上层模块,对于下层子模块,用到哪个就导入哪个;

str.zfill(n)负责在字符串前加‘0’,直到位数满足n位,±视为一个位,当原始字符串超出n位,则返回原始字符串,并不做加零处理。比如
>>> len('gotohellyou'.zfill(5))
11
>>> 'gotohellyou'.zfill(5)
'gotohellyou'
>>> 'ours'.zfill(6)
'00ours'

文件打开是,mode为a,表明是appending,即文末写入新内容;

It is good practice to use the with keyword when dealing with file objects. The advantage is that the file is properly closed after its suite finishes, even if an exception is raised at some point. Using with is also much shorter than writing equivalent try-finally blocks:
>>>
>>> with open('workfile') as f:
...     read_data = f.read()
>>> f.closed
True
If you’re not using the with keyword, then you should call f.close() to close the file and immediately free up any system resources used by it. If you don’t explicitly close a file, Python’s garbage collector will eventually destroy the object and close the open file for you, but the file may stay open for a while. Another risk is that different Python implementations will do this clean-up at different times.
这段话告诉我们:
a.打开文件用with比较安全,能保证正常关闭;
b.用with语句,比用try-finally语句块占地少;
c.读取完数据立即关闭文件释放内存,可以提升计算机的性能,避免被不同程序反复清理文件缓存;

Error  —> SyntaxError语句结构出错,不规范
Exceptions —> 运行中异常中止,无法继续,包括多种异常

_init_()负责采集参数值传给类中的self变量
类class = 概念框架
实例instance object = 案例化
属性data attribute = 案例的参数
方法method = 由类的参数决定实例所具有的功能,也就是实例的函数之类的

Generally speaking, instance variables are for data unique to each instance and class variables are for attributes and methods shared by all instances of the class。
类的属性 —>  共性,必须不可更改,即immutable,故不能用list与字典;
实例的属性 —> 个性,可更改,即mutable,可以用list与字典;

Often, the first argument of a method is called self. This is nothing more than a convention: the name self has absolutely no special meaning to Python. Note, however, that by not following the convention your code may be less readable to other Python programmers, and it is also conceivable that a class browser program might be written that relies upon such a convention.
==>method中的self实际上就是传统习俗,其实并无卵用,但又不能不写,这就好比过年时CCTV的春节晚会,有没有它都是春节,但要是不全家嗑瓜子一起胡乱看上两眼总觉得不是那回儿事;

Each value is an object, and therefore has a class (also called its type). It is stored as object.__class__.
—>python中一切所见结尾实体object,皆流淌着其群族的特征,可通过type()查询;

The random module provides tools for making random selections:
>>>
>>> import random
>>> random.choice(['apple', 'pear', 'banana'])
'apple'
>>> random.sample(range(100), 10)   # sampling without replacement
[30, 83, 16, 4, 8, 81, 41, 50, 18, 33]
>>> random.random()    # random float
0.17970987693706186
>>> random.randrange(6)    # random integer chosen from range(6)
4


3.心得感悟
A.代码编写只是动刀动枪,而框架设计才是顶层策略才能统战全局;
B.模块就是一块积木,就看你想搭建什么,要取用那些积木块,用什么排列组合进行编排组装;
C.从generator与循环语法对比来看,要考虑计算机的内存效率,编程的目的就在于优化设计一套业务程序化流程,做到低成本高效能,这和企业成本控制与战略管理如出一辙,可见各学科都是顶层思路相通;
D.类Class给我的感觉就是国际范儿名模,比较抽象高大上,Object就是眼前人,是本地化的真人,只不过这个本地人穿着超模的衣服;
E.阅读python官网document真是享受,说的有道理有例子,言简意赅,直击重点,但也是难啃啊!
F.牢记根源The Python Standard Library¶
https://docs.python.org/3/library/index.html#library-index

4.时间统计
昨日阅读5小时,累计240小时
已有 1 人评分论坛币 收起 理由
充实每一天 + 60 精彩帖子

总评分: 论坛币 + 60   查看全部评分

使用道具

29
zgs3721 发表于 2018-2-27 09:45:17 来自手机 |只看作者 |坛友微信交流群
昨天阅读2小时,总共阅读80小时
已有 1 人评分论坛币 收起 理由
充实每一天 + 10 精彩帖子

总评分: 论坛币 + 10   查看全部评分

使用道具

30
judyhust 发表于 2018-2-27 09:45:47 |只看作者 |坛友微信交流群
昨天看视频&讲义3小时,累计时间3小时。
已有 1 人评分论坛币 收起 理由
充实每一天 + 10 精彩帖子

总评分: 论坛币 + 10   查看全部评分

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jr
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-23 21:44