一: python 的简介
Python 的作者, Guido von Rossum (吉多 · 范 · 罗苏姆,中国 Python 程序员都叫他 龟叔),荷兰
人。 Python 本身也是由诸多其他语言发展而来的, Python 目前有两个版本, Python2.x 和 Python3.x
二: python 的下载和安装
Python 官网: https://www.python.org/
三:运行 Python
方式一: python 交互模式
cmd + 回车
输入 :python
输入 :print("hello world")
回车

方式二 : 集成开发环境( IDE : Integrated Development Environment ) : PyCharm
步骤:
print("hello world")

方式三:命令行脚本
步骤:python hello.py
四: python 中的基本语法
变量的定义
python
变量名 = 值
age = 18
查看变量类型 :
print(type(age))
标识符
标识符的命名规则
. 标识符只能由字母、下划线 “_” 、数字组成。
. 标识符不能以数字开头。
. 标识符不能使用关键字
. 标识符对大小写敏感。
(建议 : 标识符命名应 “ 见名知意 ” )
:python 中的关键字
['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break',
'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for',
'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or',
'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']
python 的输入和输出
输入:
input(" 提示信息 :")
输出:
print(" 输出的是 :")
换行输出 :
\n
格式化输出:
print("my name is %s, and my age is %d" %(name,age))
print("my name is {}, and my age is {}".format(age,name))
print("my name is {name}, and my age is {age}".format(age=18,name="jack"))
基本数据类型
Number (数字)
String (字符串)
List (列表)
Tuple (元组)
Set (集合)
Dictionary (字典)
作业:


版权声明:本文为j287906992原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。