Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Python-100-Days
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
huangkq
Python-100-Days
Commits
cd529ffa
Commit
cd529ffa
authored
Jun 11, 2019
by
jackfrued
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新了文档和代码
parent
c2895d7c
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
353 additions
and
28 deletions
+353
-28
01.初识Python.md
Day01-15/01.初识Python.md
+0
-0
02.语言元素.md
Day01-15/02.语言元素.md
+1
-7
settings.json
Day01-15/code/.vscode/settings.json
+3
-0
hello.py
Day01-15/code/Day01/hello.py
+6
-1
circle.py
Day01-15/code/Day02/circle.py
+0
-1
grade.py
Day01-15/code/Day03/grade.py
+5
-5
rolldice.py
Day01-15/code/Day03/rolldice.py
+0
-1
triangle.py
Day01-15/code/Day03/triangle.py
+0
-1
verify.py
Day01-15/code/Day03/verify.py
+0
-1
for4.py
Day01-15/code/Day04/for4.py
+0
-1
while2.py
Day01-15/code/Day04/while2.py
+1
-2
chicken.py
Day01-15/code/Day05/chicken.py
+0
-2
craps.py
Day01-15/code/Day05/craps.py
+0
-1
fibonacci.py
Day01-15/code/Day05/fibonacci.py
+1
-1
guess.py
Day01-15/code/Day05/guess.py
+0
-1
list_by_javascript.html
Day21-30/code/list_by_javascript.html
+119
-0
list_by_jquery.html
Day21-30/code/list_by_jquery.html
+114
-0
list_by_vue.html
Day21-30/code/list_by_vue.html
+100
-0
95.使用Django开发项目.md
Day91-100/95.使用Django开发项目.md
+1
-1
96.软件测试和自动化测试.md
Day91-100/96.软件测试和自动化测试.md
+1
-1
97.电商网站技术要点剖析.md
Day91-100/97.电商网站技术要点剖析.md
+1
-1
No files found.
Day01-15/01.初识Python.md
View file @
cd529ffa
This diff is collapsed.
Click to expand it.
Day01-15/02.语言元素.md
View file @
cd529ffa
...
...
@@ -50,7 +50,6 @@ print(a / b)
print(a // b)
print(a % b)
print(a ** b)
```
```
Python
...
...
@@ -72,7 +71,6 @@ print('%d / %d = %f' % (a, b, a / b))
print('%d // %d = %d' % (a, b, a // b))
print('%d %% %d = %d' % (a, b, a % b))
print('%d ** %d = %d' % (a, b, a ** b))
```
```
Python
...
...
@@ -94,7 +92,6 @@ print(type(b))
print(type(c))
print(type(d))
print(type(e))
```
在对变量类型进行转换时可以使用Python的内置函数(准确的说下面列出的并不是真正意义上的函数,而是后面我们要讲到的创建对象的构造方法)。
...
...
@@ -126,7 +123,7 @@ Python支持多种运算符,下表大致按照优先级从高到低的顺序
|
`not`
`or`
`and`
| 逻辑运算符 |
|
`=`
`+=`
`-=`
`*=`
`/=`
`%=`
`//=`
`**=`
`&=`
`\|=`
`^=`
`>>=`
`<<=`
| (复合)赋值运算符 |
>**说明:** 在实际开发中,如果搞不清楚
优先级
可以使用括号来确保运算的执行顺序。
>**说明:** 在实际开发中,如果搞不清楚
运算符的优先级,
可以使用括号来确保运算的执行顺序。
下面的例子演示了运算符的使用。
...
...
@@ -161,7 +158,6 @@ print("flag4 = ", flag4)
print("flag5 = ", flag5)
print(flag1 is True)
print(flag2 is not False)
```
### 练习
...
...
@@ -180,7 +176,6 @@ Author: 骆昊
f = float(input('请输入华氏温度: '))
c = (f - 32) / 1.8
print('%.1f华氏度 = %.1f摄氏度' % (f, c))
```
#### 练习2:输入圆的半径计算计算周长和面积。
...
...
@@ -200,7 +195,6 @@ perimeter = 2 * math.pi * radius
area = math.pi * radius * radius
print('周长: %.2f' % perimeter)
print('面积: %.2f' % area)
```
#### 练习3:输入年份判断是不是闰年。
...
...
Day01-15/code/.vscode/settings.json
0 → 100644
View file @
cd529ffa
{
"python.pythonPath"
:
"/Library/Frameworks/Python.framework/Versions/3.7/bin/python3"
}
\ No newline at end of file
Day01-15/code/Day01/hello.py
View file @
cd529ffa
...
...
@@ -6,8 +6,13 @@ Version: 0.1
Author: 骆昊
Date: 2018-02-26
请将该文件命名为hello.py并在终端中通过下面的命令运行它
请将该文件命名为hello.py
使用Windows的小伙伴可以在命令行提示下通过下面的命令运行该程序
python hello.py
对于使用Linux或macOS的小伙伴可以打开终端并键入下面的命令来运行程序
python3 hello.py
"""
print
(
'hello, world!'
)
...
...
Day01-15/code/Day02/circle.py
View file @
cd529ffa
...
...
@@ -5,7 +5,6 @@ Version: 0.1
Author: 骆昊
Date: 2018-02-27
"""
import
math
radius
=
float
(
input
(
'请输入圆的半径: '
))
...
...
Day01-15/code/Day03/grade.py
View file @
cd529ffa
"""
百分制成绩转等级制成绩
90分以上
-->
A
80分~89分
-->
B
70分~79分
-->
C
60分~69分
-->
D
60分以下
-->
E
90分以上
,输出
A
80分~89分
,输出
B
70分~79分
,输出
C
60分~69分
,输出
D
60分以下
,输出
E
Version: 0.1
Author: 骆昊
...
...
Day01-15/code/Day03/rolldice.py
View file @
cd529ffa
...
...
@@ -5,7 +5,6 @@ Version: 0.1
Author: 骆昊
Date: 2018-02-28
"""
from
random
import
randint
face
=
randint
(
1
,
6
)
...
...
Day01-15/code/Day03/triangle.py
View file @
cd529ffa
...
...
@@ -6,7 +6,6 @@ Version: 0.1
Author: 骆昊
Date: 2018-02-28
"""
import
math
a
=
float
(
input
(
'a = '
))
...
...
Day01-15/code/Day03/verify.py
View file @
cd529ffa
...
...
@@ -5,7 +5,6 @@ Version: 0.1
Author: 骆昊
Date: 2018-02-28
"""
# import getpass
# from getpass import getpass
# from getpass import *
...
...
Day01-15/code/Day04/for4.py
View file @
cd529ffa
...
...
@@ -5,7 +5,6 @@ Version: 0.1
Author: 骆昊
Date: 2018-03-01
"""
from
math
import
sqrt
num
=
int
(
input
(
'请输入一个正整数: '
))
...
...
Day01-15/code/Day04/while2.py
View file @
cd529ffa
...
...
@@ -6,8 +6,7 @@ Author: 骆昊
Date: 2018-03-01
"""
sum
=
0
num
=
2
sum
,
num
=
0
,
2
while
num
<=
100
:
sum
+=
num
num
+=
2
...
...
Day01-15/code/Day05/chicken.py
View file @
cd529ffa
...
...
@@ -13,5 +13,3 @@ for x in range(0, 20):
z
=
100
-
x
-
y
if
5
*
x
+
3
*
y
+
z
/
3
==
100
:
print
(
'公鸡:
%
d只, 母鸡:
%
d只, 小鸡:
%
d只'
%
(
x
,
y
,
z
))
# 要理解程序背后的算法 - 穷举法
Day01-15/code/Day05/craps.py
View file @
cd529ffa
...
...
@@ -11,7 +11,6 @@ Version: 0.1
Author: 骆昊
Date: 2018-03-02
"""
from
random
import
randint
money
=
1000
...
...
Day01-15/code/Day05/fibonacci.py
View file @
cd529ffa
...
...
@@ -10,5 +10,5 @@ Date: 2018-03-02
a
=
0
b
=
1
for
_
in
range
(
20
):
(
a
,
b
)
=
(
b
,
a
+
b
)
a
,
b
=
b
,
a
+
b
print
(
a
,
end
=
' '
)
Day01-15/code/Day05/guess.py
View file @
cd529ffa
...
...
@@ -7,7 +7,6 @@ Version: 0.1
Author: 骆昊
Date: 2018-03-02
"""
import
random
answer
=
random
.
randint
(
1
,
100
)
...
...
Day21-30/code/list_by_javascript.html
0 → 100644
View file @
cd529ffa
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
动态列表
</title>
<style>
*
{
margin
:
0
;
padding
:
0
;
}
body
{
background-color
:
#000
;
color
:
#fff
;
}
#app
{
width
:
40%
;
margin
:
20px
auto
;
}
#fruits
>
li
{
width
:
90%
;
height
:
50px
;
background-color
:
#6ca
;
margin
:
4px
0
;
text-align
:
center
;
font-size
:
20px
;
list-style-type
:
none
;
line-height
:
50px
;
}
#fruits
>
li
>
a
{
float
:
right
;
color
:
#fff
;
text-decoration
:
none
;
margin-right
:
10px
;
}
#fruits
+
div
{
margin-top
:
20px
;
}
#fname
{
width
:
70%
;
height
:
40px
;
color
:
#fff
;
border-radius
:
8px
;
border
:
none
;
outline
:
none
;
font-size
:
20px
;
text-align
:
center
;
vertical-align
:
middle
;
background-color
:
#999
;
}
#ok
{
width
:
19%
;
height
:
40px
;
color
:
#fff
;
background-color
:
#a45
;
border
:
none
;
outline
:
none
;
font-size
:
16px
;
vertical-align
:
middle
;
}
</style>
</head>
<body>
<div
id=
"app"
>
<ul
id=
"fruits"
>
<li>
苹果
<a
href=
""
>
×
</a></li>
<li>
香蕉
<a
href=
""
>
×
</a></li>
<li>
榴莲
<a
href=
""
>
×
</a></li>
<li>
火龙果
<a
href=
""
>
×
</a></li>
</ul>
<div>
<input
type=
"text"
id=
"fname"
>
<button
id=
"ok"
>
确定
</button>
</div>
</div>
<script>
const
ul
=
document
.
querySelector
(
'#fruits'
)
const
fnameInput
=
document
.
querySelector
(
'#fname'
)
const
okBtn
=
document
.
querySelector
(
'#ok'
)
const
anchors
=
document
.
querySelectorAll
(
'#fruits a'
)
function
removeItem
(
evt
)
{
evt
.
preventDefault
()
let
li
=
evt
.
target
.
parentNode
li
.
parentNode
.
removeChild
(
li
)
}
function
addItem
(
evt
)
{
let
fname
=
fnameInput
.
value
.
trim
()
if
(
fname
.
length
>
0
)
{
let
li
=
document
.
createElement
(
'li'
)
li
.
textContent
=
fname
let
a
=
document
.
createElement
(
'a'
)
a
.
setAttribute
(
'href'
,
''
)
a
.
textContent
=
'×'
a
.
addEventListener
(
'click'
,
removeItem
)
li
.
appendChild
(
a
)
ul
.
insertBefore
(
li
,
ul
.
firstElementChild
)
}
fnameInput
.
value
=
''
fnameInput
.
focus
()
}
window
.
addEventListener
(
'load'
,
(
evt
)
=>
{
for
(
let
i
=
0
;
i
<
anchors
.
length
;
i
+=
1
)
{
anchors
[
i
].
addEventListener
(
'click'
,
removeItem
)
}
fnameInput
.
addEventListener
(
'keydown'
,
(
evt
)
=>
{
let
code
=
evt
.
keyCode
||
evt
.
which
if
(
code
==
13
)
{
addItem
()
}
})
okBtn
.
addEventListener
(
'click'
,
addItem
)
})
</script>
</body>
</html>
\ No newline at end of file
Day21-30/code/list_by_jquery.html
0 → 100644
View file @
cd529ffa
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
动态列表
</title>
<style>
*
{
margin
:
0
;
padding
:
0
;
}
body
{
background-color
:
#000
;
color
:
#fff
;
}
#app
{
width
:
40%
;
margin
:
20px
auto
;
}
#fruits
>
li
{
width
:
90%
;
height
:
50px
;
background-color
:
#6ca
;
margin
:
4px
0
;
text-align
:
center
;
font-size
:
20px
;
list-style-type
:
none
;
line-height
:
50px
;
}
#fruits
>
li
>
a
{
float
:
right
;
color
:
#fff
;
text-decoration
:
none
;
margin-right
:
10px
;
}
#fruits
+
div
{
margin-top
:
20px
;
}
#fname
{
width
:
70%
;
height
:
40px
;
color
:
#fff
;
border-radius
:
8px
;
border
:
none
;
outline
:
none
;
font-size
:
20px
;
text-align
:
center
;
vertical-align
:
middle
;
background-color
:
#999
;
}
#ok
{
width
:
19%
;
height
:
40px
;
color
:
#fff
;
background-color
:
#a45
;
border
:
none
;
outline
:
none
;
font-size
:
16px
;
vertical-align
:
middle
;
}
</style>
</head>
<body>
<div
id=
"app"
>
<ul
id=
"fruits"
>
<li>
苹果
<a
href=
""
>
×
</a></li>
<li>
香蕉
<a
href=
""
>
×
</a></li>
<li>
榴莲
<a
href=
""
>
×
</a></li>
<li>
火龙果
<a
href=
""
>
×
</a></li>
</ul>
<div>
<input
type=
"text"
id=
"fname"
>
<button
id=
"ok"
>
确定
</button>
</div>
</div>
<script
src=
"https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"
></script>
<script>
// 1. $函数的参数是一个函数,该函数是页面加载完成后执行的回调函数
$
(()
=>
{
function
removeItem
(
evt
)
{
evt
.
preventDefault
()
// 4. $函数的参数是原生JavaScript对象,返回该原生JavaScript对象对应的jQuery对象
$
(
evt
.
target
).
parent
().
remove
()
}
function
addItem
(
evt
)
{
let
fname
=
$
(
'#fname'
).
val
().
trim
()
if
(
fname
.
length
>
0
)
{
$
(
'#fruits'
).
append
(
// 3. $函数的参数是标签字符串,创建对应的标签元素并返回jQuery对象
$
(
'<li>'
).
text
(
fname
).
append
(
$
(
'<a>'
).
attr
(
'href'
,
''
).
text
(
'×'
)
.
on
(
'click'
,
removeItem
)
)
)
}
$
(
'#fname'
).
val
(
''
)
// jQuery对象通过下标运算或get方法可以获得与之对应的原生JavaScript对象
// input.get(0).focus()
$
(
'#fname'
)[
0
].
focus
()
}
// 2. $函数的参数是选择器字符串,返回对应元素的jQuery对象
$
(
'#fruits a'
).
on
(
'click'
,
removeItem
)
$
(
'#ok'
).
on
(
'click'
,
addItem
)
$
(
'#fname'
).
on
(
'keydown'
,
(
evt
)
=>
{
let
code
=
evt
.
keyCode
||
evt
.
which
if
(
code
==
13
)
{
addItem
(
evt
)
}
})
})
</script>
</body>
</html>
\ No newline at end of file
Day21-30/code/list_by_vue.html
0 → 100644
View file @
cd529ffa
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
动态列表
</title>
<style>
*
{
margin
:
0
;
padding
:
0
;
}
body
{
background-color
:
#000
;
color
:
#fff
;
}
#app
{
width
:
40%
;
margin
:
20px
auto
;
}
#fruits
>
li
{
width
:
90%
;
height
:
50px
;
background-color
:
#6ca
;
margin
:
4px
0
;
text-align
:
center
;
font-size
:
20px
;
list-style-type
:
none
;
line-height
:
50px
;
}
#fruits
>
li
>
a
{
float
:
right
;
color
:
#fff
;
text-decoration
:
none
;
margin-right
:
10px
;
}
#fruits
+
div
{
margin-top
:
20px
;
}
#fname
{
width
:
70%
;
height
:
40px
;
color
:
#fff
;
border-radius
:
8px
;
border
:
none
;
outline
:
none
;
font-size
:
20px
;
text-align
:
center
;
vertical-align
:
middle
;
background-color
:
#999
;
}
#ok
{
width
:
19%
;
height
:
40px
;
color
:
#fff
;
background-color
:
#a45
;
border
:
none
;
outline
:
none
;
font-size
:
16px
;
vertical-align
:
middle
;
}
</style>
</head>
<body>
<div
id=
"app"
>
<ul
id=
"fruits"
>
<li
v-for=
"fruit in fruits"
>
{{ fruit }}
<a
href=
""
@
click
.
prevent=
"removeItem(fruit)"
>
×
</a>
</li>
</ul>
<div>
<input
@
keydown
.
enter=
"addItem()"
type=
"text"
id=
"fname"
v-model=
"fname"
>
<button
id=
"ok"
@
click=
"addItem()"
>
确定
</button>
</div>
</div>
<script
src=
"https://cdn.bootcss.com/vue/2.6.10/vue.min.js"
></script>
<script>
const
app
=
new
Vue
({
el
:
'#app'
,
data
:
{
fruits
:
[
'苹果'
,
'香蕉'
,
'榴莲'
,
'火龙果'
],
fname
:
''
},
methods
:
{
addItem
()
{
if
(
this
.
fname
.
trim
().
length
>
0
)
{
this
.
fruits
.
push
(
this
.
fname
.
trim
())
}
this
.
fname
=
''
},
removeItem
(
fruit
)
{
let
index
=
this
.
fruits
.
indexOf
(
fruit
)
if
(
index
>=
0
)
{
this
.
fruits
.
splice
(
index
,
1
)
}
}
}
})
</script>
</body>
</html>
\ No newline at end of file
Day91-100/95.使用Django开发项目.md
View file @
cd529ffa
##
Django知识点概述
##
使用Django开发项目
> 说明:本文的部分插图来自于《Python项目开发实战》和《精通Django》,这两本书中都包含了对Django框架精彩的讲解,有兴趣的读者可以自行购买阅读。
...
...
Day91-100/96.软件测试和自动化测试.md
View file @
cd529ffa
##
关于
测试
##
软件测试和自动化
测试
### 软件测试概述
...
...
Day91-100/97.电商网站技术要点剖析.md
View file @
cd529ffa
...
...
@@ -812,7 +812,7 @@ HAYSTACK_CONNECTIONS = {
# 引擎配置
'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
# 搜索引擎服务的URL
'URL': 'http://1.2.3.4
:
9200',
'URL': 'http://1.2.3.4
:
9200',
# 索引库的名称
'INDEX_NAME': 'goods',
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment