Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
python-demo
提交
21b5fdec
P
python-demo
项目概览
Kwan的解忧杂货铺@新空间代码工作室
/
python-demo
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
python-demo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
21b5fdec
编写于
7月 21, 2024
作者:
秦
秦英杰
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:基础语法
上级
d63485fe
变更
17
展开全部
隐藏空白更改
内联
并排
Showing
17 changed file
with
214 addition
and
679 deletion
+214
-679
.idea/inspectionProfiles/Project_Default.xml
.idea/inspectionProfiles/Project_Default.xml
+73
-2
.idea/material_theme_project_new.xml
.idea/material_theme_project_new.xml
+4
-1
.idea/misc.xml
.idea/misc.xml
+4
-1
.idea/modules.xml
.idea/modules.xml
+0
-8
.idea/python-demo.iml
.idea/python-demo.iml
+0
-4
.idea/vcs.xml
.idea/vcs.xml
+1
-1
.idea/workspace.xml
.idea/workspace.xml
+89
-637
01_Python入门语法/02_Python中的注释.py
01_Python入门语法/02_Python中的注释.py
+5
-1
01_Python入门语法/04_Python中的数据类型.py
01_Python入门语法/04_Python中的数据类型.py
+4
-4
01_Python入门语法/08_Python的字符串格式化.py
01_Python入门语法/08_Python的字符串格式化.py
+3
-0
02_Python判断语句/01_布尔类型和比较运算符.py
02_Python判断语句/01_布尔类型和比较运算符.py
+7
-0
02_Python判断语句/05_if_elif_else语句的使用.py
02_Python判断语句/05_if_elif_else语句的使用.py
+0
-3
03_Python循环语句/01_while循环练习题_求1-100的和.py
03_Python循环语句/01_while循环练习题_求1-100的和.py
+3
-1
03_Python循环语句/06_for循环练习题-数一数有几个a.py
03_Python循环语句/06_for循环练习题-数一数有几个a.py
+3
-2
03_Python循环语句/07_for循环的基础语法.py
03_Python循环语句/07_for循环的基础语法.py
+3
-1
03_Python循环语句/08_range语句.py
03_Python循环语句/08_range语句.py
+7
-5
03_Python循环语句/12_循环中断.py
03_Python循环语句/12_循环中断.py
+8
-8
未找到文件。
.idea/inspectionProfiles/Project_Default.xml
浏览文件 @
21b5fdec
<component
name=
"InspectionProjectProfileManager"
>
<component
name=
"InspectionProjectProfileManager"
>
<profile
version=
"1.0"
>
<profile
version=
"1.0"
>
<option
name=
"myName"
value=
"Project Default"
/>
<option
name=
"myName"
value=
"Project Default"
/>
<inspection_tool
class=
"PyPep8NamingInspection"
enabled=
"true"
level=
"WEAK WARNING"
enabled_by_default=
"true"
>
<inspection_tool
class=
"DotEnvLowercaseKeyInspection"
enabled=
"false"
level=
"WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"DotEnvSpaceAroundSeparatorInspection"
enabled=
"false"
level=
"WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"DotEnvSpaceInsideNonQuotedInspection"
enabled=
"false"
level=
"WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"DuplicatedCode"
enabled=
"false"
level=
"WEAK WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"Eslint"
enabled=
"true"
level=
"WARNING"
enabled_by_default=
"true"
/>
<inspection_tool
class=
"GrazieInspection"
enabled=
"false"
level=
"GRAMMAR_ERROR"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"HtmlFormInputWithoutLabel"
enabled=
"false"
level=
"WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"HtmlUnknownAttribute"
enabled=
"true"
level=
"WARNING"
enabled_by_default=
"true"
>
<option
name=
"myValues"
>
<value>
<list
size=
"3"
>
<item
index=
"0"
class=
"java.lang.String"
itemvalue=
"lay-verify"
/>
<item
index=
"1"
class=
"java.lang.String"
itemvalue=
"lay-submit"
/>
<item
index=
"2"
class=
"java.lang.String"
itemvalue=
"lay-filter"
/>
</list>
</value>
</option>
<option
name=
"myCustomValuesEnabled"
value=
"true"
/>
</inspection_tool>
<inspection_tool
class=
"JSUnusedAssignment"
enabled=
"false"
level=
"WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"PyArgumentListInspection"
enabled=
"false"
level=
"WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"PyBroadExceptionInspection"
enabled=
"false"
level=
"WEAK WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"PyDictCreationInspection"
enabled=
"false"
level=
"WEAK WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"PyExceptionInheritInspection"
enabled=
"false"
level=
"WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"PyInterpreterInspection"
enabled=
"false"
level=
"WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"PyMethodMayBeStaticInspection"
enabled=
"false"
level=
"WEAK WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"PyPackageRequirementsInspection"
enabled=
"false"
level=
"WARNING"
enabled_by_default=
"false"
>
<option
name=
"ignoredPackages"
>
<value>
<list
size=
"5"
>
<item
index=
"0"
class=
"java.lang.String"
itemvalue=
"chromadb"
/>
<item
index=
"1"
class=
"java.lang.String"
itemvalue=
"openai"
/>
<item
index=
"2"
class=
"java.lang.String"
itemvalue=
"fastapi"
/>
<item
index=
"3"
class=
"java.lang.String"
itemvalue=
"chromadb-client"
/>
<item
index=
"4"
class=
"java.lang.String"
itemvalue=
"langchain"
/>
</list>
</value>
</option>
</inspection_tool>
<inspection_tool
class=
"PyPep8Inspection"
enabled=
"true"
level=
"WEAK WARNING"
enabled_by_default=
"true"
>
<option
name=
"ignoredErrors"
>
<list>
<option
value=
"E501"
/>
</list>
</option>
</inspection_tool>
<inspection_tool
class=
"PyPep8NamingInspection"
enabled=
"false"
level=
"WEAK WARNING"
enabled_by_default=
"false"
>
<option
name=
"ignoredErrors"
>
<option
name=
"ignoredErrors"
>
<list>
<list>
<option
value=
"N802"
/>
<option
value=
"N802"
/>
<option
value=
"N803"
/>
<option
value=
"N806"
/>
</list>
</list>
</option>
</option>
</inspection_tool>
</inspection_tool>
<inspection_tool
class=
"PyUnresolvedReferencesInspection"
enabled=
"true"
level=
"WARNING"
enabled_by_default=
"true"
>
<inspection_tool
class=
"PyProtectedMemberInspection"
enabled=
"false"
level=
"WEAK WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"PyShadowingBuiltinsInspection"
enabled=
"false"
level=
"WEAK WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"PyShadowingNamesInspection"
enabled=
"false"
level=
"WEAK WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"PyStatementEffectInspection"
enabled=
"false"
level=
"WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"PyTestUnpassedFixtureInspection"
enabled=
"false"
level=
"WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"PyTypeCheckerInspection"
enabled=
"false"
level=
"WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"PyTypedDictInspection"
enabled=
"false"
level=
"WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"PyUnreachableCodeInspection"
enabled=
"false"
level=
"WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"PyUnresolvedReferencesInspection"
enabled=
"false"
level=
"WARNING"
enabled_by_default=
"false"
>
<option
name=
"ignoredIdentifiers"
>
<option
name=
"ignoredIdentifiers"
>
<list>
<list>
<option
value=
"socketio.*"
/>
<option
value=
"socketio.*"
/>
</list>
</list>
</option>
</option>
</inspection_tool>
</inspection_tool>
<inspection_tool
class=
"PyprojectInspection"
enabled=
"false"
level=
"WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"ShellCheck"
enabled=
"true"
level=
"ERROR"
enabled_by_default=
"true"
>
<shellcheck_settings
value=
"SC2006,SC2164,SC2181"
/>
</inspection_tool>
<inspection_tool
class=
"SpellCheckingInspection"
enabled=
"false"
level=
"TYPO"
enabled_by_default=
"false"
>
<option
name=
"processCode"
value=
"true"
/>
<option
name=
"processLiterals"
value=
"true"
/>
<option
name=
"processComments"
value=
"true"
/>
</inspection_tool>
<inspection_tool
class=
"SqlConstantConditionInspection"
enabled=
"false"
level=
"WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"SqlConstantExpressionInspection"
enabled=
"false"
level=
"WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"SqlDialectInspection"
enabled=
"false"
level=
"WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"SqlNoDataSourceInspection"
enabled=
"false"
level=
"WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"UnsatisfiedRequirementInspection"
enabled=
"false"
level=
"WARNING"
enabled_by_default=
"false"
/>
<inspection_tool
class=
"VulnerableLibrariesLocal"
enabled=
"false"
level=
"WARNING"
enabled_by_default=
"false"
/>
</profile>
</profile>
</component>
</component>
\ No newline at end of file
.idea/material_theme_project_new.xml
浏览文件 @
21b5fdec
...
@@ -3,7 +3,10 @@
...
@@ -3,7 +3,10 @@
<component
name=
"MaterialThemeProjectNewConfig"
>
<component
name=
"MaterialThemeProjectNewConfig"
>
<option
name=
"metadata"
>
<option
name=
"metadata"
>
<MTProjectMetadataState>
<MTProjectMetadataState>
<option
name=
"userId"
value=
"e706d3a:190c6184f70:-7c34"
/>
<option
name=
"migrated"
value=
"true"
/>
<option
name=
"pristineConfig"
value=
"false"
/>
<option
name=
"userId"
value=
"1961fa40:1886d73b1f5:-8000"
/>
<option
name=
"version"
value=
"8.13.2"
/>
</MTProjectMetadataState>
</MTProjectMetadataState>
</option>
</option>
</component>
</component>
...
...
.idea/misc.xml
浏览文件 @
21b5fdec
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.9 (chatgpt)"
project-jdk-type=
"Python SDK"
/>
<component
name=
"Black"
>
<option
name=
"sdkName"
value=
"Python 3.9 (chatgpt)"
/>
</component>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"web"
project-jdk-type=
"Python SDK"
/>
</project>
</project>
\ No newline at end of file
.idea/modules.xml
已删除
100644 → 0
浏览文件 @
d63485fe
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ProjectModuleManager"
>
<modules>
<module
fileurl=
"file://$PROJECT_DIR$/.idea/python-demo.iml"
filepath=
"$PROJECT_DIR$/.idea/python-demo.iml"
/>
</modules>
</component>
</project>
\ No newline at end of file
.idea/python-demo.iml
浏览文件 @
21b5fdec
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<module
version=
"4"
>
<module
version=
"4"
>
<component
name=
"NewModuleRootManager"
>
<orderEntry
type=
"jdk"
jdkName=
"Python 3.9 (chatgpt)"
jdkType=
"Python SDK"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
</component>
<component
name=
"PyDocumentationSettings"
>
<component
name=
"PyDocumentationSettings"
>
<option
name=
"format"
value=
"PLAIN"
/>
<option
name=
"format"
value=
"PLAIN"
/>
<option
name=
"myDocStringFormat"
value=
"Plain"
/>
<option
name=
"myDocStringFormat"
value=
"Plain"
/>
...
...
.idea/vcs.xml
浏览文件 @
21b5fdec
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"VcsDirectoryMappings"
>
<component
name=
"VcsDirectoryMappings"
>
<mapping
directory=
"
$PROJECT_DIR$
"
vcs=
"Git"
/>
<mapping
directory=
""
vcs=
"Git"
/>
</component>
</component>
</project>
</project>
\ No newline at end of file
.idea/workspace.xml
浏览文件 @
21b5fdec
此差异已折叠。
点击以展开。
01_Python入门语法/02_Python中的注释.py
浏览文件 @
21b5fdec
name
=
"""
name
=
"""
多行注释
多行注释
"""
"""
"""
WEFSFSDFWF
"""
print
(
name
)
print
(
name
)
# 写一个整数字面量
# 写一个整数字面量
666
666
# 写一个浮点数字面量
# 写一个浮点数字面量
13.14
13.14
# 222
# 写一个字符串字面量
# 写一个字符串字面量
"程序员"
"程序员"
...
@@ -14,7 +19,6 @@ print(name)
...
@@ -14,7 +19,6 @@ print(name)
print
(
666
)
print
(
666
)
print
(
13.14
)
print
(
13.14
)
print
(
"程序员"
)
print
(
"程序员"
)
# 单行注释
# 单行注释
#
#
#
#
...
...
01_Python入门语法/04_Python中的数据类型.py
浏览文件 @
21b5fdec
# 方式1: 使用print直接输出类型信息
# 方式1: 使用print直接输出类型信息
print
(
type
(
"程序员"
))
print
(
type
(
"程序员"
))
print
(
type
(
666
))
int_type
=
type
(
666
)
print
(
int_type
)
print
(
type
(
11.345
))
print
(
type
(
11.345
))
# 方式2: 使用变量存储type()语句的结果
# 方式2: 使用变量存储type()语句的结果
string_type
=
type
(
"程序员"
)
string_type
=
type
(
"程序员"
)
int_type
=
type
(
666
)
int_type
=
int_type
float_type
=
type
(
11.345
)
float_type
=
type
(
11.345
)
print
(
string_type
)
print
(
string_type
)
print
(
int_type
)
print
(
int_type
)
print
(
float_type
)
print
(
float_type
)
# 方式3: 使用type()语句,查看变量中存储的数据类型信息
# 方式3: 使用type()语句,查看变量中存储的数据类型信息
name
=
"程序员"
name
=
"程序员"
name_type
=
type
(
name
)
name_type
=
type
(
name
)
...
...
01_Python入门语法/08_Python的字符串格式化.py
浏览文件 @
21b5fdec
...
@@ -21,3 +21,5 @@ print("数字11宽度限制5,结果是:%5d" % num1)
...
@@ -21,3 +21,5 @@ print("数字11宽度限制5,结果是:%5d" % num1)
print
(
"数字11宽度限制1,结果是:%1d"
%
num1
)
print
(
"数字11宽度限制1,结果是:%1d"
%
num1
)
print
(
"数字11.345宽度限制7,小数精度2,结果是:%7.2f"
%
num2
)
print
(
"数字11.345宽度限制7,小数精度2,结果是:%7.2f"
%
num2
)
print
(
"数字11.345不限制,小数精度2,结果是:%.2f"
%
num2
)
print
(
"数字11.345不限制,小数精度2,结果是:%.2f"
%
num2
)
print
(
f
"message =
{
name
}
,成立于:
{
setup_year
}
,我今天的股价是:
{
stock_price
}
"
)
\ No newline at end of file
02_Python判断语句/01_布尔类型和比较运算符.py
浏览文件 @
21b5fdec
...
@@ -4,9 +4,16 @@
...
@@ -4,9 +4,16 @@
"""
"""
# 定义变量存储布尔类型的数据
# 定义变量存储布尔类型的数据
bool_1
=
True
bool_1
=
True
#
# if today == 21:
# bool_1 = False
print
(
f
"bool_1=
{
bool_1
}
"
)
bool_2
=
False
bool_2
=
False
print
(
f
"bool_1变量的内容是:
{
bool_1
}
, 类型是:
{
type
(
bool_1
)
}
"
)
print
(
f
"bool_1变量的内容是:
{
bool_1
}
, 类型是:
{
type
(
bool_1
)
}
"
)
print
(
f
"bool_2变量的内容是:
{
bool_2
}
, 类型是:
{
type
(
bool_2
)
}
"
)
print
(
f
"bool_2变量的内容是:
{
bool_2
}
, 类型是:
{
type
(
bool_2
)
}
"
)
# 比较运算符的使用
# 比较运算符的使用
# == , !=, >, <, >=, <=
# == , !=, >, <, >=, <=
# 演示进行内容的相等比较
# 演示进行内容的相等比较
...
...
02_Python判断语句/05_if_elif_else语句的使用.py
浏览文件 @
21b5fdec
...
@@ -12,6 +12,3 @@ elif int(input("请告诉我今天几号:")) == 1:
...
@@ -12,6 +12,3 @@ elif int(input("请告诉我今天几号:")) == 1:
print
(
"今天是1号免费日,可以免费"
)
print
(
"今天是1号免费日,可以免费"
)
else
:
else
:
print
(
"不好意思,条件都不满足,需要买票10元。"
)
print
(
"不好意思,条件都不满足,需要买票10元。"
)
03_Python循环语句/01_while循环练习题_求1-100的和.py
浏览文件 @
21b5fdec
...
@@ -3,8 +3,10 @@
...
@@ -3,8 +3,10 @@
"""
"""
sum
=
0
sum
=
0
i
=
1
i
=
1
res
=
[]
while
i
<=
100
:
while
i
<=
100
:
sum
+=
i
sum
+=
i
print
(
i
)
print
(
i
)
res
.
append
(
i
)
i
+=
1
i
+=
1
print
(
f
"1-100累加的和是:
{
s
um
}
"
)
print
(
f
"1-100累加的和是:
{
s
tr
(
res
)
}
"
)
03_Python循环语句/06_for循环练习题-数一数有几个a.py
浏览文件 @
21b5fdec
...
@@ -2,12 +2,13 @@
...
@@ -2,12 +2,13 @@
演示for循环的练习题:数一数有几个a
演示for循环的练习题:数一数有几个a
"""
"""
# 统计如下字符串中,有多少个字母a
# 统计如下字符串中,有多少个字母a
name
=
"itheima is a brand of itcast"
# name = "itheima is a brand of itcast"
name
=
[
1
,
2
,
3
,
4
,
5
]
# 定义一个变量,用来统计有多少个a
# 定义一个变量,用来统计有多少个a
count
=
0
count
=
0
# for 循环统计
# for 循环统计
# for 临时变量 in 被统计的数据:
# for 临时变量 in 被统计的数据:
for
x
in
name
:
for
x
in
name
:
if
x
==
"a"
:
if
x
==
3
:
count
+=
1
count
+=
1
print
(
f
"被统计的字符串中有
{
count
}
个a"
)
print
(
f
"被统计的字符串中有
{
count
}
个a"
)
03_Python循环语句/07_for循环的基础语法.py
浏览文件 @
21b5fdec
...
@@ -3,8 +3,10 @@
...
@@ -3,8 +3,10 @@
"""
"""
name
=
"itheima"
name
=
"itheima"
# range
for
x
in
name
:
for
x
in
name
:
if
x
==
"i"
:
print
(
x
)
# 将name的内容,挨个取出赋予x临时变量
# 将name的内容,挨个取出赋予x临时变量
# 就可以在循环体内对x进行处理
# 就可以在循环体内对x进行处理
print
(
x
)
print
(
x
)
...
...
03_Python循环语句/08_range语句.py
浏览文件 @
21b5fdec
...
@@ -12,9 +12,11 @@
...
@@ -12,9 +12,11 @@
# print(x)
# print(x)
# range 语法3 range(num1, num2, step)
# range 语法3 range(num1, num2, step)
# for x in range(5, 10, 2
):
for
x
in
range
(
5
,
10
,
3
):
#
# 从5开始,到10结束(不包含10本身)的一个数字序列,数字之间的间隔是2
# 从5开始,到10结束(不包含10本身)的一个数字序列,数字之间的间隔是2
#
print(x)
print
(
x
)
for
x
in
range
(
10
):
# for x in range(5):
print
(
"送玫瑰花"
)
# print(x)
# if x % 2 == 0:
# print("送玫瑰花")
03_Python循环语句/12_循环中断.py
浏览文件 @
21b5fdec
...
@@ -10,14 +10,14 @@ num = random.randint(1, 10)
...
@@ -10,14 +10,14 @@ num = random.randint(1, 10)
# continue
# continue
# print("语句2")
# print("语句2")
# 演示continue的嵌套应用
# 演示continue的嵌套应用
#
for i in range(1, 6):
for
i
in
range
(
1
,
6
):
#
print("语句1")
print
(
"语句1"
)
#
for j in range(1, 6):
for
j
in
range
(
1
,
6
):
#
print("语句2")
print
(
"语句2"
)
#
continue
continue
#
print("语句3")
print
(
"语句3"
)
#
#
print("语句4")
print
(
"语句4"
)
# 演示循环中断语句 break
# 演示循环中断语句 break
# for i in range(1, 101):
# for i in range(1, 101):
# print("语句1")
# print("语句1")
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录