巴扎黑
浏览量11958    |    粉丝242    |    关注1
  • 巴扎黑

    巴扎黑

    2016-12-07 10:46:03
    python 列表list去重
    python 列表list去重 一.{}.fromkeys(list).keys() list2 = {}.fromkeys(list1).keys() 二.set list2 = list(set(list1)) 三.itertools.grouby ids = [1,4,3,3,4,2,3,4,5,6,1] ids.sort() it = itertools. ...
    1769
  • 巴扎黑

    巴扎黑

    2016-12-07 10:47:39
    python的range()方法
    使用python的人都知道range()函数很方便,今天再用到他的时候发现了很多以前看到过但是忘记的细节。这里记录一下range(),复习下list的slide,最后分析一个好玩儿的冒泡程序。 这里记录一下: >>> range(1,5) #代表从1到5(不包含5) [1, 2, 3, 4] >>> range(1,5,2) #代表从1到 ...
    2014
  • 巴扎黑

    巴扎黑

    2016-12-07 10:53:05
    python实现选择排序
    #!/usr/bin/env python #coding=utf-8 #ChooseSort.py #user can choose sort style: desc(1) or asc(2) import stdinInput def chooseSort( sortArray): arrayl=len(sortArray) if(arrayl<1): ...
    1516
  • 巴扎黑

    巴扎黑

    2016-12-07 10:55:46
    python实现二叉树的中序遍历
    #!/usr/bin/env python # coding=utf-8 # inorderBL.py import stdinInput def inorder(arrays,arraysize,currentP): if(2*currentP+1<arraysize): inorder(arrays,arraysize,2*currentP+1) ...
    2166
  • 巴扎黑

    巴扎黑

    2016-12-07 11:00:03
    冒泡排序python实现
    开始学习python,格式神马的都是浮云,直接上数据结构的算法。毕竟读代码学习最快 1 接受输入的py代码,以后的算法的输入import这个文件 #!/usr/bin/env python #coding=utf-8 # stdinInput.py intsortArrays=[] def stdinInput(): sortArray=raw_input(" ...
    1790
  • 巴扎黑

    巴扎黑

    2016-12-07 11:05:45
    python正则表达式中的中文匹配例子
    #coding=utf-8 import re from urllib2 import urlopen webpage = urlopen('http://www.baidu.com') #获取百度页面的信息 text = webpage.read() #读取为文本 tmp = text.decode('utf8 ...
    1801
  • 巴扎黑

    巴扎黑

    2016-12-07 11:11:38
    python 获取当前时间
    我有的时候写程序要用到当前时间,我就想用python去取当前的时间,虽然不是很难,但是老是忘记,用一次丢一次, 为了能够更好的记住,我今天特意写下python 当前时间这篇文章,如果你觉的对你有用的话,可以收藏下。 取得时间相关的信息的话,要用到python ti ...
    2019
  • 巴扎黑

    巴扎黑

    2016-12-07 11:16:22
    python shelve模块
    shelve shelve是一额简单的数据存储方案,他只有一个函数就是open(),这个函数接收一个参数就是文件名,然后返回一个shelf对象,你可以用他来存储东西,就可以简单的把他当作一个字典,当你存储完毕的时候,就调用close函数来关闭 这个有一个潜在的小问题,如下: [python] view plaincopy >>> import shelve >>&g ...
    1633
  • 巴扎黑

    巴扎黑

    2016-12-07 11:19:58
    python入门 读写文件
    1.打开文件,读取所有内容 file_object = open('thefile.txt')try: all_the_text = file_object.read( )finally: file_object.close( ) 2.读取固定字节 file_object = open('abinfile', 'rb')try: while True: ...
    1386
  • 巴扎黑

    巴扎黑

    2016-12-07 11:21:35
    python 元类
    元类有什么用? 很好的问题,元类将用在创建使用了它的新类时调用,这里是一些关于这样做的好处的观点: ◆ 装饰(Decorate)类的所有方法,用以日志记录或者性能剖分。 ◆ 自动 Mix-in 新方法 ◆ 在创建时注册类。(例如自动注册插件或从类成员创建数据库模式。) ◆ 提供接口注册,功能自动发现和接口适配。 ◆ 类校验:防止子类化,校验所有的方法是否都有 ...
    1496

最新下载

更多>
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号