Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 205abf6

Browse files
committed
Initial commit
0 parents commit 205abf6

File tree

70 files changed

+33607
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+33607
-0
lines changed

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.ipynb_checkpoints
2+
__pycache__
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# 1. 变量"
8+
]
9+
},
10+
{
11+
"cell_type": "code",
12+
"execution_count": 1,
13+
"metadata": {},
14+
"outputs": [
15+
{
16+
"name": "stdout",
17+
"output_type": "stream",
18+
"text": [
19+
"Hello World\n"
20+
]
21+
}
22+
],
23+
"source": [
24+
"message = \"Hello World\"\n",
25+
"print(message)"
26+
]
27+
},
28+
{
29+
"cell_type": "markdown",
30+
"metadata": {},
31+
"source": [
32+
"这里message为一个变量,与字符串"Hello World"关联在一起。\n",
33+
"- 变量名只能包含字母、数字和下划线,变量名可以字母或下划线开头,但不能以数字开头。\n",
34+
"- 变量名不能包含空格,但可以使用下划线分隔其中单词。\n",
35+
"- 不能将Python关键字和函数名用作函数名。\n",
36+
"- 变量名应既简短又具有描述性。\n",
37+
"- 慎用小写字母l和大写字母O。 \n",
38+
"\n",
39+
"在Python中: \n",
40+
"- 变量在它第一次赋值时创建。\n",
41+
"- 变量在表达式中使用将被替换为它们的值。\n",
42+
"- 变量在表达式中使用以前必须已赋值。\n",
43+
"- 变量像对象一样不需要在一开始进行声明。\n",
44+
"\n",
45+
"Python中有三个主要类型(以及操作)的分类: \n",
46+
"- 数字(整数、浮点数、二进制、分数等) \n",
47+
" 支持加法和乘法等。 \n",
48+
"- 序列(字符串、列表、元组) \n",
49+
" 支持索引、分片和合并等。 \n",
50+
"- 映射(字典) \n",
51+
" 支持通过键的索引等。 \n",
52+
"\n",
53+
"Python中主要核心类型划分为如下两类: \n",
54+
"- **不可变类型**:数字、字符串、元组、不可变集合 \n",
55+
"- **可变类型**:列表、字典、可变集合"
56+
]
57+
},
58+
{
59+
"cell_type": "markdown",
60+
"metadata": {},
61+
"source": [
62+
"# 2. Python对象类型"
63+
]
64+
},
65+
{
66+
"cell_type": "markdown",
67+
"metadata": {},
68+
"source": [
69+
"```python\n",
70+
"# Numbers \n",
71+
"# 数字\n",
72+
"1234,3.1415,3+4j,0b111\n",
73+
"\n",
74+
"# Strings\n",
75+
"# 字符串\n",
76+
"'spam',\"Bob's\",b'a\\x01c',u'sp\\xc4m'\n",
77+
"\n",
78+
"# Lists\n",
79+
"# 列表\n",
80+
"[1,[2,'three'],4.5],list(range(10))\n",
81+
"\n",
82+
"# Dictionaries \n",
83+
"# 字典\n",
84+
"{'food':'spam','taste':'yum'},dict(hours=10)\n",
85+
"\n",
86+
"# Tuples\n",
87+
"# 元组\n",
88+
"(1,'spam',4,'U'),tuple('spam'),namedtuple\n",
89+
"\n",
90+
"# Files\n",
91+
"# 文件\n",
92+
"open('eggs.txt'),open(r'C:\\ham.bin','wb')\n",
93+
"\n",
94+
"# Sets\n",
95+
"# 集合\n",
96+
"set('abc'),{'a','b','c'}\n",
97+
"\n",
98+
"# Other core types \n",
99+
"# 其他类型\n",
100+
"Booleans,types,None\n",
101+
"\n",
102+
"# Program unit types\n",
103+
"# 程序单元类型\n",
104+
"Functions,modules,classes\n",
105+
"\n",
106+
"# Implementation-related types\n",
107+
"# 与实现相关的类型\n",
108+
"Compiled code,stack tracbacks\n",
109+
"```"
110+
]
111+
},
112+
{
113+
"cell_type": "code",
114+
"execution_count": null,
115+
"metadata": {
116+
"collapsed": true
117+
},
118+
"outputs": [],
119+
"source": []
120+
}
121+
],
122+
"metadata": {
123+
"kernelspec": {
124+
"display_name": "Python 3",
125+
"language": "python",
126+
"name": "python3"
127+
},
128+
"language_info": {
129+
"codemirror_mode": {
130+
"name": "ipython",
131+
"version": 3
132+
},
133+
"file_extension": ".py",
134+
"mimetype": "text/x-python",
135+
"name": "python",
136+
"nbconvert_exporter": "python",
137+
"pygments_lexer": "ipython3",
138+
"version": "3.6.5"
139+
}
140+
},
141+
"nbformat": 4,
142+
"nbformat_minor": 2
143+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /