1. 列表的基本语法
- 使用中括号
[]
表示列表 - 列表内元素用逗号
,
隔开(注意:逗号为英文输入法下的逗号,
)
student1 = ['Ran', 'class1', 18, 20250417]
student2 = ['Peppa', 'class2', 8, 20250418]
原创2025年4月17日...大约 9 分钟
Snake my way to a content heart
[]
表示列表,
隔开(注意:逗号为英文输入法下的逗号 ,
)student1 = ['Ran', 'class1', 18, 20250417]
student2 = ['Peppa', 'class2', 8, 20250418]
三种方法:
string = 'I am born for this.' #英文表达
#string = 'I'm born for this.' # I am 缩写成 I‘m,与表示字符串的引号冲突,错误。
string = "I'm born for this." # 正确表达
print(string)
#-------output-------
I'm born for this.
pycharm 中点击左边栏下侧 terminal,输入命令 pip install ipython
。
如果遇到无法安装,提示如下报错,则需要关闭代理(首页或设置处虚拟代理开关),安装成功后再打开。
启动 ipython, 终端输入 ipython 即可,退出输入 exit。
使用 ipython 优点:输入和输出一一对应,方便查找,不需要用 print 就可以输出结果。
string = "hello world"
t = type(string)
print(string)
print("string type is:>>>", t)
print("直接检测数据类型,并输出:>>>", type(string))
#-------output-------
hello world
string type is:>>> <class 'str'>
直接检测数据类型,并输出:>>> <class 'str'>
——所以,变量不就是在计算机的内存中开辟空间,来储存数据。 (ctrl + B
加粗)
特点:变量的值会被覆盖,只会记得最后一个值。
Markdown 使用 LaTeX 语法支持数学公式,需要用美元符号 $
或 $$
包围公式内容,例如:
$E = mc^2$
$$\sum_{i=1}^{n} i = \frac{n(n+1)}{2}$$
利用 VuePress Theme Hope 创建个人博客,主页点击 “快速上手” 查看参考教程。
按照 “快速上手” 中 “运行环境设置” 安装 VSCode、Node.js、pnpm(项目管理器)等。
选择合适的储存位置,建议纯英文路径,如:D:\Static-Site-Build
。
xxx