1.1 Python解释器
语言 = 语法 + 解释器
解释器的本质:打开一个文件,把文件内容加载到内存中,在内存中的代码运行起来后,把结果反馈给终端。
1.2 Python输入输出
输入:input
raw_input(python2中输入关键字)
变量名 = 变量值
查看变量类型:type(变量名)
查看类说明及可用方法:help(类名)
查看类或库可用方法:dir(类名或变量名代表的数据类型或库名)
1 str = "mashuyi" 2 help(type(str)) 3 dir(int) 4 a = 12 5 dir(a) = dir(int) 6 import json 7 dir(json)
Python常用数据类型:str int float bool(True,False)
输出:output
‘‘‘ 三引号,输出多行内容
1.3 Pycharm使用小技巧
配置python文件模板
settings->搜索template->File and Code Templates
1.4 Python中的编码方式
python2默认字符编码是ASCII码
1.为了处理英文字符,产生ASCII编码
2.为了处理中文字符,产生GB2312
3.为了处理各国字符,产生Unicode
4.为了提高Unicode的存储和性能,产生UTF-8,它是Unicode的一种实现形式
原文:https://www.cnblogs.com/mashuyi/p/11235258.html