python语言基础
文章平均质量分 62
划过的梦神
Action speak louder than words.
展开
-
python学习笔记-函数式编程
函数式编程主要包含lambda()、map()、reduce()、filter()函数,使用如下: 1.lambda函数,主要用来定义‘行内函数’ 2.map()函数,多用于逐一遍历 使用列表解析:a1 = [1, 2, 3, 4, 5]b1 = [i + 2 for i in a1]print b1使用map()函数:a2 = [1, 2, 3, 4, 5]b2 = map(lambd原创 2017-03-27 15:48:18 · 586 阅读 · 0 评论 -
Python 手记
Python 手记python 2.7notepid ++ 编辑器《简明 Python 教程》www.byteofpython.info获得人生中的成功需要的专注与坚持不懈多过天才与机会。——C.W. WendtewxPython、Twisted和Python图像库Python.org/download点击控制面板->系统->高级->环境变量。在“系统变量”原创 2017-03-24 10:32:11 · 462 阅读 · 0 评论 -
python入门(四)
python运算符与运算符优先级1.运算符** 幂运算// 求商的整数部分~ 取反 1 #coding=utf-8 2 #运算符 3 a=10%4 4 b=10//4 5 print a 6 print b 7 #按为与“&”,按位或“|”,按位异或“^” 8 c=7&18 9 print c10 #7->0000011111原创 2017-03-24 10:31:11 · 340 阅读 · 0 评论 -
python入门(三)
python基本语法1.python的常量与变量 Python常量需要用对象的方式来定义,先定义一个const模块,再导入文件中使用。定义:const.py,放入Python的lib库中。1 class _const: 2 class ConstError(TypeError):pass 3 def __setattr__(self, name, va原创 2017-03-24 10:31:07 · 410 阅读 · 0 评论 -
python入门(二)
web2py项目的建立与使用1.所需工具pycharm-professional-2016.1下载地址:http://www.jetbrains.com/pycharm/download/破解方法, 0x1 ,安装 0x2 , 调整时间到2038年。 0x3 ,申请30天试用 0x4, 退出pycharm 0x5, 时间调整回来。web2python框架地址:ww原创 2017-03-24 10:31:02 · 401 阅读 · 0 评论 -
python入门(一)
python入门基本语法1.自定义函数#coding=utf-8#自定义函数,传入参数,没有传入参数def sayHello(): print ("hello word")def maxed(a,b): if(a>b): print(a) else: print(b)sayHello()p原创 2017-03-24 10:30:57 · 479 阅读 · 0 评论 -
python入门(七)
python数据结构一、数据结构概述 数据组织在一起的结构叫做数据结构。 python中的数据结构:列表,元组,字典,队列,栈,树等等。 python内置数据结构:列表、元组等。 python扩展数据结构:栈,队列等。 数据结构式静态的,算法是动态的。 数据结构示例: 1 #coding=utf-8 2 ''' 3 Created on 2016��原创 2017-03-24 10:31:32 · 450 阅读 · 0 评论 -
python入门(六)
python函数与模块一、python函数1.认识函数 函数分为系统函数与自定义函数。 1 #coding=utf-8 2 ''' 3 Created on 2016年4月19日 4 5 @author: Administrator 6 ''' 7 #函数的功能 8 #系统函数 9 #1.取字符串长度10 '''11 a="hello原创 2017-03-24 10:31:28 · 653 阅读 · 0 评论 -
python入门(五)
python控制流1.python 三种控制流 顺序结构,分支结构,循环结构2.if语句 要点:各分支尽量不要重复,并且尽可能包含全部可能性。 1 #coding=utf-8 2 #一种选择情况下的if语句用法 3 a=8 4 #if a==8: 5 # print "hello" 6 #if a!=8: 7 # print "hehe" 8原创 2017-03-24 10:31:23 · 344 阅读 · 0 评论