-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcorepython-reading-notes-how-day2.html
192 lines (146 loc) · 7.65 KB
/
corepython-reading-notes-how-day2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="HandheldFriendly" content="True" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="robots" content="index, follow" />
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:ital,wght@0,400;0,700;1,400&family=Source+Sans+Pro:ital,wght@0,300;0,400;0,700;1,400&display=swap" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="https://blog.tonychow.me/theme/stylesheet/style.min.css">
<link id="pygments-light-theme" rel="stylesheet" type="text/css"
href="https://blog.tonychow.me/theme/pygments/colorful.min.css">
<link rel="stylesheet" type="text/css" href="https://blog.tonychow.me/theme/font-awesome/css/fontawesome.css">
<link rel="stylesheet" type="text/css" href="https://blog.tonychow.me/theme/font-awesome/css/brands.css">
<link rel="stylesheet" type="text/css" href="https://blog.tonychow.me/theme/font-awesome/css/solid.css">
<link href="https://blog.tonychow.me/feeds/all.atom.xml" type="application/atom+xml" rel="alternate" title="Tonychow's Blog Atom">
<!-- Chrome, Firefox OS and Opera -->
<meta name="theme-color" content="#333333">
<!-- Windows Phone -->
<meta name="msapplication-navbutton-color" content="#333333">
<!-- iOS Safari -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<!-- Microsoft EDGE -->
<meta name="msapplication-TileColor" content="#333333">
<meta name="author" content="tonychow" />
<meta name="description" content="" />
<meta name="keywords" content="corepython, reading-notes, python">
<meta property="og:site_name" content="Tonychow's Blog"/>
<meta property="og:title" content="Python 核心编程读书笔记 Day2"/>
<meta property="og:description" content=""/>
<meta property="og:locale" content="en_US"/>
<meta property="og:url" content="https://blog.tonychow.me/corepython-reading-notes-how-day2.html"/>
<meta property="og:type" content="article"/>
<meta property="article:published_time" content="2014-07-11 00:00:00+08:00"/>
<meta property="article:modified_time" content=""/>
<meta property="article:author" content="https://blog.tonychow.me/author/tonychow.html">
<meta property="article:section" content="readings"/>
<meta property="article:tag" content="corepython"/>
<meta property="article:tag" content="reading-notes"/>
<meta property="article:tag" content="python"/>
<meta property="og:image" content="/images/avatar.jpg">
<title>Tonychow's Blog – Python 核心编程读书笔记 Day2</title>
</head>
<body class="light-theme">
<aside>
<div>
<a href="https://blog.tonychow.me/">
<img src="/images/avatar.jpg" alt="" title="">
</a>
<h1>
<a href="https://blog.tonychow.me/"></a>
</h1>
<p>Go/Python backend developer</p>
<ul class="social">
<li>
<a class="sc-github" href="https://github.com/chow1937" target="_blank">
<i class="fab fa-github"></i>
</a>
</li>
</ul>
</div>
</aside>
<main>
<nav>
<a href="https://blog.tonychow.me/">Home</a>
<a href="/archives.html">Archives</a>
<a href="/categories.html">Categories</a>
<a href="/tags.html">Tags</a>
<a href="https://blog.tonychow.me/feeds/all.atom.xml">Atom</a>
</nav>
<article class="single">
<header>
<h1 id="corepython-reading-notes-how-day2">Python 核心编程读书笔记 Day2</h1>
<p>
Posted on 五 11 七月 2014 in <a href="https://blog.tonychow.me/category/readings.html">readings</a>
• 1 min read
</p>
</header>
<div>
<p>今天主要阅读了 5 - 7 章的内容,继续总结每章的内容及要点。</p>
<h3>第五章:数字</h3>
<p>本章介绍 Python 中的各种数字类型及其运算符和处理数字的内建函数。要点如下:</p>
<p>1.Python 中的数字类型包括整型,长整型,布尔型,双精度浮点型,十进制浮点型和复数,都是不可变类型,对数字类型变量的变
更都会产生一个新的对象;</p>
<p>2.现在的 Python 支持整型自动转换为长整型,不会溢出;</p>
<p>3.Python 中只采用了双精度浮点型,不实现单精度浮点型,如果需要进行银行等系统编写可以考虑使用 Decimal 模块;</p>
<p>4.Python 中不同类型数字运算转换规则:存在复数转换为复数,否则存在浮点数则转换为浮点数,否则存在长整数则转换为长整
数,否则都是普通整数;</p>
<p>5.divmod 函数用于数值计算,返回一个包含商和余数的元组;</p>
<p>6.round 函数对数值进行四舍五入取整,返回一个浮点数;</p>
<p>7.chr 函数将 ASCII 值的数字转换为 ASCII 字符,ord 则相反;</p>
<h3>第六章:序列:字符串,列表和元组</h3>
<p>这一章关注的是 Python 中的序列类型,这些类型的特点是其成员有序排序,可以通过下标以类似偏移量的方式访问其成员,具体
来说这样的序列类型有三个:字符串,列表和元组。本章详细地介绍了这三个序列类型的操作符内建函数和特性等内容,以下为要
点:</p>
<p>1.序列类型可以使用 <code>in</code> 和 <code>not in</code> 来判定某个元素是否属于一个序列;</p>
<p>2.对于序列使用 <code>+</code> 连接符会导致一个新的序列对象产生;</p>
<p>3.序列类型支持切片操作,可以使用 seq[start:stop:step] 来进行;</p>
<p>4.enumerate 函数接受一个可迭代对象,同样返回一个可迭代的 enumerate 对象,内容为之前对象的 index 和 item;</p>
<p>5.字符串是不可变类型,Python 中没有字符类型,可以用长度为 1 的字符串来表达这个概念;</p>
<p>6.Python 格式化字符:%[(name)][flags][width].[precision]typecode;</p>
<p>7.Python 格式化字符默认右对齐,<code>-</code> 改为左对齐,默认填充空格;</p>
<p>8.<code>r</code> 添加在字符串前表示为原始字符串,不需要对特殊字符进行转义;</p>
<p>9.Unicode 字符串 encode 为 str 字符串,str 字符串 decode 为 Unicode 字符串;</p>
<p>10.列表是可变类型,支持添加插入或者删除元素,并不会产生新的元素;</p>
</div>
<div class="tag-cloud">
<p>
<a href="https://blog.tonychow.me/tag/corepython.html">corepython</a>
<a href="https://blog.tonychow.me/tag/reading-notes.html">reading-notes</a>
<a href="https://blog.tonychow.me/tag/python.html">python</a>
</p>
</div>
</article>
<footer>
<p>
© 2017 - This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/deed.en_US" target="_blank">Creative Commons Attribution-ShareAlike</a>
</p>
<p>
Built with <a href="http://getpelican.com" target="_blank">Pelican</a> using <a href="http://bit.ly/flex-pelican" target="_blank">Flex</a> theme
</p><p>
<a rel="license"
href="http://creativecommons.org/licenses/by-sa/4.0/"
target="_blank">
<img alt="Creative Commons License"
title="Creative Commons License"
style="border-width:0"
src="https://i.creativecommons.org/l/by-sa/4.0/80x15.png"
width="80"
height="15"/>
</a>
</p> </footer>
</main>
<script type="application/ld+json">
{
"@context" : "http://schema.org",
"@type" : "Blog",
"name": " Tonychow's Blog ",
"url" : "https://blog.tonychow.me",
"image": "/images/avatar.jpg",
"description": "tonychow's Thoughts and Writings"
}
</script>
</body>
</html>