Python 安装及脚本使用

安装Python:

前提环境将途中软件安装即可Python 安装及脚本使用

在C盘下创建python文件并记住路径

Python 安装及脚本使用

修改计算机参数设置

Python 安装及脚本使用
Python 安装及脚本使用
Python 安装及脚本使用
Python 安装及脚本使用

CMD命令终端

Python 安装及脚本使用

脚本使用如:

实验:
实验一:利用字典编写一个通讯录脚本,并能够准确查询
实验二:利用python绘制两个柱形图,left=1,8,height=5,10,widthall=4
实验三:创建列表[‘2145,’2147’,’2148’],并在2145后插入2146,然后查看列表
实验四:创建元组(‘linux高级管理’,’linux群集与维护’,’华为’),查看元组,将元组转化为列表,并在liunx群集与维护后插入v*n与高可用,再将列表转换为元组

一:创建字典通讯脚本并查询

mobile = {‘shw’:‘18729006091’,‘xhj’:‘186562817631’}
print mobile [“shw”]

二:利用Python制作绘图脚本
import sys
reload (sys)
sys.setdefaultencoding(‘gbk’)
import matplotlib.pyplot as plt
plt.bar(left=(1,6),height=(6,10),width=4)
plt.show()

三:创建列表并添加查询
num =[‘001’,‘002’,‘003’]
num.insert(1,‘004’)
print num

四:元组换列表插入数据后修改为元组
shw = {‘linuxguan’,‘linuxwei’,‘huawei’}
print shw
listshw = list(shw)
print listshw
listshw.insert(2,‘v*n’)
tuplelistshw = tuple(listshw)
print tuplelistshw

如想更简便可将其写为以个脚本或俩个随各人意愿