![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
xiaojun_Fairy
正在学习Linux
展开
-
python的基础
python简介Python, 是一种面向对象的解释型计算机程序设计语言,由荷兰人Guido van Rossum于1989年发明,第一个公开发行版发行于1991年。 Python具有丰富和强大的库。它常被昵称为胶水语言,能够把用其他语言制作的各种模块(尤其是C/C++)很轻松地联结在一起。常见的一种应用情形是,使用Python快速生成程序的原型(有时甚至是程序的最终界面),然后对其中[3] 有原创 2017-06-29 00:17:48 · 471 阅读 · 0 评论 -
python 函数高级特性
迭代可以通过 for 循环来遍历这个 list 或 tuple,这种遍历我们称为迭代(Iteration) 只要是可迭代对象,无论有无下标,都可以迭代,比如 dict就可以迭代:迭代的类型判断可迭代对象方法是通过 collections 模块的 Iterable 类型判断In [1]: from collections import Iterable##字符串In [2]: isinstance原创 2017-07-17 19:37:19 · 416 阅读 · 0 评论 -
python模块和包
模块什么是模块所有以.py结尾的都可以认为是一个模块,逻辑上组织python代码(函数,变量,类)模块的导入方式import module —直接导入模块 module.add() module.variable.add() from module import add —-导入模块的方法 add() from module import add as myadd原创 2017-07-15 22:00:47 · 380 阅读 · 0 评论 -
Python的异常处理
常见错误1.ZeroDivisionError(零除错误)In [1]: 10/0---------------------------------------------------------------------------ZeroDivisionError Traceback (most recent call last)<ipytho原创 2017-07-17 18:33:14 · 1869 阅读 · 0 评论 -
python作业7.8
6.定义一个函数func(*args),该函数效果如下:func(222,111,’xian’,’hahaah’) –> ‘xian’ func(7,’name’,’fensi’) —>’fensi’ func(1,2,3,4) —> None源代码:#!/usr/bin/env python# coding:utf-8__author__ = "lvah"'''@author:fai原创 2017-07-06 04:12:28 · 508 阅读 · 0 评论 -
Pyrhon中Mysql数据库的操作
mysql基础设置1.下载 yum install mariadb-server MySQL-python -y sytemctl start mariadb mysql_secure_installation2.utf-8 vim /etc/my.cnf charset = utf-8 systemctl restart mariadbpython操作mysqlMySQL连接操作##导原创 2017-07-17 17:52:45 · 904 阅读 · 0 评论 -
python之元组
元组原创 2017-07-06 03:16:21 · 316 阅读 · 0 评论 -
python之列表
列表的定义定义一个空列表>>> list = []>>> list[]定义一个包含元素的列表,元素可以是任意类型,包括数值类型,列表,字符串等均可>>> a = ['zz',23,'happy']>>> a['zz', 23, 'happy']列表的索引下标示从0开始,-1表示倒数第一个>>> a['zz', 23, 'happy']>>> a[1]23>>> a[0]'zz'原创 2017-07-06 02:57:46 · 366 阅读 · 0 评论 -
python之函数
函数的定义def 函数名(参数):# 函数在执行过程中一旦遇到return时,函数就执行完毕,并将结果返回。# 函数在执行过程中没有遇到return时,返回值为None.def hello(): return 'hello' print 'fentiao'print hello()调用函数Python 内置了很多有用的函数,我们可以直接调用: • abs() • cmp()原创 2017-07-14 20:50:32 · 403 阅读 · 0 评论 -
python之字典
为什么需要字典In [1]: list1 = ['name','age','class']In [2]: list2 = ['haha',14,'linux']In [3]: zip(list1,list2)Out[3]: [('name', 'haha'), ('age', 14), ('class', 'linux')]zip函数可以将两个列表结合 字典就如中文字典,起到原创 2017-07-14 20:11:51 · 313 阅读 · 0 评论 -
python作业(7.8 —— 7.9)
8.登陆系统import time 1). Creat : 2). Login : 3). Delete : 4). View : 登陆时判断本次登陆与上次登陆时间的差,如果time<4h,显示,你已经登陆在4小时前。 源代码:#!/usr/bin/env python# coding:utf-8__author__ = "lvah"import time'''@author:f原创 2017-07-11 21:51:03 · 554 阅读 · 0 评论 -
python之字符串
接字符串的切片字符串的判断子串判断字符 | 字符串是否属于字符串,用 字符/字符串 in 字符串In [5]: a = 'hello world'In [6]: 'a' in a ##判断字符a是否属于字符串aOut[6]: FalseIn [7]: 'ello' in a ##判断字符串ello是否属于字符串aOut[7]: TrueIn [8]: 'elo' in aOut[8]:原创 2017-07-05 00:59:23 · 242 阅读 · 0 评论 -
python之集合
集合的定义PS.集合不能为空##集合可以是普通的数字In [1]: s1 = {1,2,3}In [2]: type(s1)Out[2]: set##集合是一个无序的,不重复的数据组合In [3]: s2 = {1,2,3,2,3,4}In [4]: s2Out[4]: {1, 2, 3, 4}In [5]: type(s2)Out[5]: set##集合可以含有字符串In [6]: s原创 2017-07-12 21:33:49 · 316 阅读 · 0 评论 -
python作业
题目编程使用pycharm 测试输入正确用户名和密码时 输入三次错误的用户名和密码时 源码#!/usr/bin/env python# coding:utf-8__author__ = "lvah"'''@author:fairy@file:homework.py@time:6/28/1711:34 PM@DESC;'''USERNAME = 'fairy'PASSWORD原创 2017-06-29 11:47:45 · 309 阅读 · 0 评论 -
在已有python2的基础上安装python3
操作环境系统版本:redhat7.2 seliux:disabled firewalld:inactive源码包的获取GNS包:这里我是通过访问官网获取的3-2.1.2版本压缩包GNS3-2.1.2.source.zip;地址:https://github.com/GNS3/gns3-gui/releases或者使用 wget https://github.com/GNS原创 2018-09-25 21:57:00 · 838 阅读 · 0 评论