序列化 Serialization
序列化是指将一个 对象转换为字节序列 的过程,方便
存储 或 传输.
序列化的目的是为了将对象从内存中变成可存储或传输的格式,方便后续的读取和使用.
序列化的过程一般分为两步:
将对象转换为字节序列 : 将 对象转换为字节序列
的过程称为 序列化.
序列化的过程一般通过将对象转换为字节序列来实现. 常见的序列化方式有
JSON、XML、Pickle...
存储或传输字节序列:序列化后的字节序列可以存储在
文件、数据库、网络...之中,也可以通过
网络传输 到另一台计算机上.
python 中将对此有专门的模块 JSON 来实现序列化.
12345import json# 序列化data = {'name': 'Alice', 'age': 25, 'city': 'Beijing'}json_str = json.dumps(data)print(json_str)
序列化之后的结果为:
1{"name": "Alice", "age": 25, "city": "Beijing"}
反序列化 Deserial ...
限制性关系从句 (
defining relative clause )
在复合句中,修饰名词或代词的从句叫做 定语从句.
被定语从句所修饰的词叫 先行词.
引导定语从句的词叫 关系词.
关系词包括 关系代词 和
关系副词.
一个简单的例子.
I fell in love with someone who is considerate.
先行词 someone关系词 who 在句子中做成分替代先行词
本句中做了主语成分.
做题步骤
划出先行词
将先行词带入从句,看作何成分得出关系词
做 主宾表 - 选关系代词 [ that ( 人
/ 物 ),which ( 物 ),who ( 人
),whom,as ] ( 无 what )
做 状语 - 选关系副词 [
when,where,why,介词
+ which ] ( 无 how )
做 定语 - 选关系形容词 [ whose =
of whom / which ]
1.I have an apple _____ is green. 查看答案
> that / whic ...
图像属性
接下来简单介绍几个常用的图形属性.
坐标轴上下限
设置坐标轴上下限有两种方法 lim 和
axis.
示例 1
效果图
代码
lim
12345678910import matplotlib.pyplot as pltx = [520, 521, 522, 523]y = [1, 2, 3, 4]fig1 = plt.figure()plt.plot(x, y, color='#112d4e')plt.xlim(520, 523)plt.ylim(1, 4)plt.show()
axis
123456789import matplotlib.pyplot as pltx = [520, 521, 522, 523]y = [1, 2, 3, 4]fig1 = plt.figure()plt.plot(x, y, color='#112d4e')plt.axis([520, 523, 1, 4])plt.show()
plt.axis('equal') 会变成 1 : 1 比例
标题 与 坐标轴标签
示例 2
用中心极限定理示例.
...
二维网格图
在此演示如何用 Matplotlib ( python 第三方库 )
绘制一些常见的统计图.
hist() 绘制 直方图 ( histogram
).
示例
效果图
代码
123456789101112131415import matplotlib.pyplot as pltimport numpy as npdata1 = np.random.normal(3, 1, 10000)data2 = np.random.normal(6, 1, 10000)data3 = np.random.normal(9, 1, 10000)fig1 = plt.figure()plt.hist(data1, bins=20, histtype='stepfilled', alpha=0.5, color='#ff165d', edgecolor='#ff9999', label='l1')plt.hist(data2, bins=20, histtype='stepfilled', alpha=0.5, color='#ff9a00', edgecolor='#ff ...
二维图
二维图作为常见的图像,熟练掌握是非常必要的. 在此演示如何用 Matplotlib
( python 第三方库 ) 绘制一些常见的二维图.
plot() 可用于绘制 线图 和
散点图.
示例1
效果图
代码
123456789101112131415161718192021import numpy as npimport matplotlib.pyplot as pltfig1= plt.figure()x = np.arange(0, 6, 0.5)y = np.arange(6,12,0.5)y1 = np.arange(5,11,0.5)y2 = np.arange(4,10,0.5)y3 = np.arange(3,9,0.5)y4 = np.arange(2,8,0.5)y5 = np.arange(1,7,0.5)plt.plot(x, y,color='#f6416c',linestyle='-',linewidth=3)plt.plot(x, y1,color='#f38181', linestyle=' ')plt.plot(x, y2,c ...
虚拟语气
句子当中的谓语动词能 准确
地反映出时间的变化,而虚拟语气则通过谓语动词 时态前移
给人一种 虚假 的感觉,通常由 if 引导
用于 条件状语从句 中.
时态前移
将时态向前移动.
一般现在 ( do,does ) ->
一般过去 ( did )
一般过去 ( did ) -> 过去完成 (
had done )
一般将来 ( will do ) -> 过去将来
( would do ) -> 过去将来完成 ( would have done )
现在完成 ( have / has done ) ->
过去完成 ( had done )
虚拟
从句动词
主句动词
对现在
did / were
should / might / could / would + do
对将来
did / were should do were to
do
would do
对过去
had done
would have done
...
f7da7c884a6b688aba5491acdb33ad62e0c7a1c1c9c8bde4277012d40669e116205cdb49c6b1ea36fbc43f72a10fbf5c029f0666ac6b50ec3c3ae20964660bca1e7dd255bee2b6fd4210dec256289efbc02eac9e03be8d63e16355c3ac8195aa73bb920f8d1c71d0de3a31e09323c5aa118461ae4c4a2937705d16c6a5afda87845a17001e13c09f98d9c392cb5fe7371d9b063a13231e902961cea0dd978afd90c2d33e4f1407a2e4ff0fecdd968a84fc152f4f756eb820fdf239f9aedcd3aefd338808c00f3fef7a6dbc48b57ee187d791bab9d17cef9d0c2f7f83526157d048d066564ad59d2ea6d5badd683e191f6260a98e1f4475ab6 ...
英语常用词根词缀
高频前缀
anti- 相反的 : antiwar, antimatter,
antinuclear
auto- 自动的 : automatic,
autobiography
ab- 相反,变坏,离去 : abnormal, abuse, abandon,
abolish
bi- 两个 : bicycle, bilingual, biweekly
by- 在旁边,副的 : byproduct, byroad
co- 共同,一起 : coauthor, cooperate,
coexist
counter- 相反 : counteract, counterattack,
contrary, contrast
dis- 否定,相反或相对 : disagree, disadvantage,
dishonest
de- 否定,去掉,减少,离开 : devalue,
deforestation, decode
em- 用在b.p.前,使…进入状态 : embody,
empower
ex- 前,前任 : ex-wife, ex-pres ...
NPC 分析法
NPC 即为 非谓语动词 ( Nonfinite verbs ) 介词 (
Preposition ) 从句 ( Clause )
取各自首字母缩写.
NPC 分析法通过找出长难句中 NPC 这三种
后置修饰标志,从而对一个复杂的长难句进行
断句 并逐一 匹配 好对应的
修饰关系,从而达到 理解 长难句.
而 NPC 就是根据以下进行断句.
非谓语动词 Nonfinite verbs
不定式 to do 动名词 v.+ting 分词
v.+ed / v.+ing
凡是 左边有「 be 动词 」的 ing 或 ed 形式的 动词
统统都不是 修饰.
介词 Preposition
on,in,at,of,by,for...
从句 Clause
从句引导词
that,
what,which,who,whom,as...
举个例子
But the Nobel Foundation’s limit of three recipients per prize, each
of whom must still ...
第一章 计算机系统概述
计算机硬件的发展
发展阶段
时间
逻辑元件
速度(次/秒)
内存
外存
第一代
1946-1957
电子管
几千-几万
汞延迟线、磁鼓
穿孔卡片、纸带
第二代
1958-1964
晶体管
几万-几十万
磁芯存储器
磁带
第三代
1964-1971
中小规模集成电路
几十万-几百万
半导体存储器
磁带、磁盘
第四代
1972-现在
大规模、超大规模集成电路
上千万-万亿
半导体存储器
磁盘、磁带、光盘、半导体存储器
冯诺依曼计算机
冯 · 诺依曼计算机的特点
计算机由 五⼤部件 组成. (
输⼊设备,输出设备,存储器,运算器,控制器 )
指令和数据以同等地位存储在存储器中,并 按地址
寻访.
指令和数据均以 ⼆进制代码 表示. ( CPU
区分指令和数据的依据是指令周期的不同阶段,数据由指令的地址码给出. )
指令 = 操作码 + 地址码.
操作码⽤来表示操作的性质,地址码⽤来 ...