按类别查询搜索结果
关于关键词 的检测结果,共 8682
【LINUX】 python librtmp
zds05 | 2019-03-13 17:26:28 | 阅读(0) | 评论(0)
git clone git://github.com/chrippa/python-librtmp.gitcd rtmpdump/make installsudo python setup.py install/usr/lib64/python2.7/site-packages/python_librtmp-0.3.0-py2.7-linux-x86_64.egg/librtmp/ldd _librtmp.so cp /usr/local/lib/librtmp.so.1 /lib64/【阅读全文】
可怜的猪头 | 2019-03-13 15:13:55 | 阅读(4610) | 评论(0)
数量词{1,2}非贪婪{1,2}?* 号 前面的字符匹配0次或无限多次+号 前面的字符匹配一次或无限多次?号前面的字符匹配0次或一次边界匹配^    $以上都是指的字符,下面介绍组组的概念()[root@localhost /]# cat str.py #!/bin/pythonimport rea='python 1111java678php'b=re.findall('[a-z]{3,6}?',a...【阅读全文】
brjl | 2019-03-11 23:36:12 | 阅读(73090) | 评论(0)
面对100多套ORACLE数据库,领导想问数据库链都有多少啊,给我查出来。我:好的conn.txt 内容是 scott/tiger@orcl1scott/tom@zhcx2...(以下是一百个连接信息,略)import cx_Oracle with open("conn.txt", "r") as f:    for line in f.readlines():    ...【阅读全文】
可怜的猪头 | 2019-03-07 11:05:22 | 阅读(2640) | 评论(0)
[root@localhost /]# [root@localhost /]# cat zlg.py #!/bin/pythonfrom random import randintimport timemylist=[1,2,3,4]mylist.reverse()for x in mylist:    print xmytuple=(1,2,3,4)for y in range(len(mytuple)-1,-1,-1):    print mytuple[y]mystr='hello you are a b...【阅读全文】
可怜的猪头 | 2019-03-06 16:33:52 | 阅读(1610) | 评论(0)
1.如何反向迭代一个序列2.如何查询和替换一个文本中的字符串3.使用python实现单例模式4.重新实现str.strip()5.闭包6.给列表中的字典排序7.合并两个列表排除重复元素8.打乱一个排好序的列表...【阅读全文】
可怜的猪头 | 2019-03-06 13:45:58 | 阅读(1530) | 评论(0)
那么怎么能够让类只创建一个实例,而后再创建的实例是返回上一次的对象的引用呢?我们了解到,python中,一个类创建对象实例是通过调用父类object的 __new__(cls)方法来创建对象的我们可以通过重写 __new__(cls)方法去实现类只创建一个实例代码如下:    class Earth(object):    ...【阅读全文】
【SQLite/嵌入式数据库】 Python爬虫成香饽饽?
duanwenbai | 2019-03-05 17:57:04 | 阅读(330) | 评论(0)
网络爬虫又称网络蜘蛛、网络蚂蚁、网络机器人等,可以按照我们制定的规则自动化浏览网络中的信息,这称之为网络爬虫算法。【阅读全文】
hmchzb19 | 2019-03-02 15:47:50 | 阅读(1800) | 评论(0)
我这里大部分代码出自The Python Master一书。1. 在python的class里面,允许同名的方法存在。但是后定义的方法会覆盖掉先定义的方法.例如:点击(此处)折叠或打开class Dod1:        def method1(self):&nb...【阅读全文】
【系统运维】 Python剪刀石头布游戏
haoque672 | 2019-03-01 19:31:15 | 阅读(1330) | 评论(0)
#!/urs/bin/env pythonimport randomall_choice = ['石头','剪刀','布']win_list = [['石头','剪刀'],['剪刀','布'],['布','石头']]prompt = """(0) 石头(1) 剪刀(2) 布Please input your choice(0/1/2): """computer = random.choice(all_choice)ind = int(input(prompt))player = all_choice[ind]print("Y...【阅读全文】
可怜的猪头 | 2019-03-01 13:53:30 | 阅读(14960) | 评论(0)
[root@localhost /]# [root@localhost /]# cat ./for.py #!/bin/pythonfrom random import randintfrom itertools import chaina=[randint(10,100) for _ in range(20)]b=[randint(10,100) for _ in range(20)]c=[randint(10,100) for _ in range(20)]for n,m,v in zip(a,b,c):    print n+m+vcou...【阅读全文】
873313579 | 2019-02-28 22:05:25 | 阅读(1910) | 评论(0)
#!/urs/bin/env pythonimport randomall_choice = ['石头','剪刀','布']win_list = [['石头','剪刀'],['剪刀','布'],['布','石头']]prompt = """(0) 石头(1) 剪刀(2) 布Please input your choice(0/1/2): """computer = random.choice(all_choice)ind = int(input(prompt))player = all_choice[ind]print("Y...【阅读全文】
可怜的猪头 | 2019-02-26 10:53:31 | 阅读(4540) | 评论(0)
[root@localhost /]# [root@localhost /]# cat split.py #!/bin/pythonimport res='aa,bb:cc;dd/tee<ff>gg'def mysplit(s,symbol):    t=[s]    for num in symbol:        res=[]        map(lambda x:res.extend(x....【阅读全文】
【网络与安全】 使用python自动发送邮件
rain99 | 2019-02-26 10:09:45 | 阅读(1670) | 评论(0)
# -*- coding: utf-8 -*-This is free software; see LICENSE file for copying conditions. There is NOimport timeimport jsonimport osimport base64from urllib import requestfrom email.mime.text import MIMETextfrom email.mime.multipart import MIMEMultipart...【阅读全文】
可怜的猪头 | 2019-02-25 17:18:32 | 阅读(1900) | 评论(0)
[root@localhost /]# [root@localhost /]# cat strduiqi.py #!/bin/pythonimport os, statli=os.listdir('/software/script/shell')st=[n for n in li if n.endswith(('.sh','.py'))]for nm in st:    os.chmod(nm,os.stat(nm).st_mode | stat.S_IXGRP)[root@localhost /]# [root@localhost /]# ...【阅读全文】
可怜的猪头 | 2019-02-25 16:57:05 | 阅读(2530) | 评论(0)
[root@localhost /]# cat strduiqi.py #!/bin/pythonimport relog=open('/var/log/pacman.log').read()print re.sub('(\d{4})-(\d{2})-(\d{2})',r'\2/\3/\1',log)[root@localhost /]# 捕获组命名[root@localhost /]# cat strduiqi.py #!/bin/pythonimport relog=open('/var/log/pacman.log').read()print re.sub...【阅读全文】
可怜的猪头 | 2019-02-25 16:39:44 | 阅读(8530) | 评论(0)
[root@localhost /]# cat strduiqi.py #!/bin/pythonmydict={'name':'zhuliguo','age':29,'student':'student'}length=max(map(len,mydict.keys()))for n in mydict:    print(n.ljust(length),':',mydict[n])[root@localhost /]# 【阅读全文】
hmchzb19 | 2019-02-23 17:39:19 | 阅读(53300) | 评论(0)
使用python中的字典来模拟其他语言中的case,switch 语句。使用函数作为字典的value. 看代码很直观。该代码出自The Python Master一书.点击(此处)折叠或打开def labyrinth(position, alive):    print('You are in a maze of twisty passages, all alike...【阅读全文】
【Python/Ruby】 Python爬虫实战公开课
mmz_77 | 2019-02-20 15:25:27 | 阅读(120) | 评论(0)
源码时代2019年首次公开课就在本周六哦!本次公开课也将为大家理性分析Python职位需求,希望对感兴趣的小伙伴有所帮助!马云曾说:未来最大的能源不是石油,而是大数据。对大数据的获取处理与分析,以及基于大数据的智能应用,已成为提高未来竞争力的关键要素,网络爬虫就是一种高效的数据采集利器,可以说网络爬虫技术几...【阅读全文】
可怜的猪头 | 2019-01-24 13:35:46 | 阅读(18820) | 评论(0)
[root@localhost /]# [root@localhost /]# cat cla.py#!/bin/pythonclass zhu():    def __init__(self,chang,kuan,gao):        self.chang=chang        self.kuan=kuan        self.gao=gao &n...【阅读全文】
可怜的猪头 | 2019-01-24 13:09:48 | 阅读(12470) | 评论(0)
[root@localhost /]# [root@localhost /]# cat zlg.py #!/bin/pythonfrom functools import reducea=[1,2,3,4,5,6,7,8,9]b=[2,3,4,5,6,7,8,9,1]r=map(lambda x,y:x+y,a,b)print list(r)x=3y=4print x if x>y else yp=reduce(lambda x,y:x+y,a)print p[root@localhost /]# [root@localhost /]# ...【阅读全文】