按类别查询搜索结果
关于关键词 的检测结果,共 880
可怜的猪头 | 2019-01-23 17:20:57 | 阅读(6140) | 评论(0)
帮助函数:>>> help(str.join)>>> help(str)>>> [root@localhost /]# cat zifuchuan.py #!/bin/pythona='aaaaaaaaaaaaa'b='bbbbbbbbbbbb'c=a+bprint cd=['ddddddd','eeeeeeee','fffffffff']g=':'.join(d)h=''.join(d)print g,ho=['aaaaa',12,'23']print ''.join(str(x) for x in o)[root@localhost /]# ...【阅读全文】
可怜的猪头 | 2019-01-22 13:51:58 | 阅读(4110) | 评论(0)
https://www.cnblogs.com/lihanx/p/5947178.html1.查看一下当前Python的版本$ python -V注意这里“V”是大写的,记得当前python的版本,之后会用得到。我的当前版本是2.6.6。 2.安装过程中需要拥有root权限,所以在一开始就获取root$ su root 注意这里执行命令后提示输入密码,但是输入过...【阅读全文】
可怜的猪头 | 2019-01-22 13:50:23 | 阅读(3730) | 评论(0)
数据类型,转化,序列化,反序列化新建了一个文件:json.pyimport  jsondata = [{'a':1,'b':2,'c':3,'d':4,'e':5}]json = json.dumps(data)print json执行结果报:AttributeError: 'module' object has no attribute 'dumps'解决方案:就是因为命名的文件名json给python内置的json重名了,所有在导入的时候是我...【阅读全文】
可怜的猪头 | 2019-01-22 10:43:36 | 阅读(11630) | 评论(0)
[root@localhost /]# cat zifuchuan.py #!/bin/pythonimport res=' ---asdegsd:34fr++++ 'print(s.strip())print(s.lstrip())print(s.rstrip())print(s[:11]+s[12:])print(s.replace('-','h'))print(s.translate(None,'a'))print(re.sub('a','',s))[root@localhost /]# 【阅读全文】
可怜的猪头 | 2019-01-21 13:17:07 | 阅读(17890) | 评论(0)
[root@localhost /]# cat key.py #!/bin/pythonfrom random import *import refrom collections import Countera=[randint(1,15) for _ in range(20)]b=dict.fromkeys(a,0)for i in b:    b[i]+=1e=[(k,v) for k,v in b.items()]print(sorted(e))c=Counter(a)d=c.most_common(3)print aprint ...【阅读全文】
可怜的猪头 | 2019-01-21 10:54:17 | 阅读(18220) | 评论(0)
server:[root@localhost /]# cat server.py #!/bin/pythonimport socketser=socket.socket()hostname=socket.gethostname()port=1234A=hostname,portser.bind(A)ser.listen(5)while 1:    cli,addr=ser.accept()    print addr    cli.send('hahhahahahahahha'...【阅读全文】
可怜的猪头 | 2019-01-21 10:41:15 | 阅读(11370) | 评论(0)
[root@localhost /]# cat threadzlg.py#!/bin/pythonimport threadingimport timeclass mythread(threading.Thread):    def __init__(self,name,tim):        threading.Thread.__init__(self)        self.name=name   &n...【阅读全文】
可怜的猪头 | 2019-01-21 10:29:00 | 阅读(5080) | 评论(0)
[root@localhost /]# cat list.py #!/bin/pythonfrom random import randintd=[randint(-10,10) for _ in range(10)]s={'student%d' %i:randint(-10,10) for i in range(10)}t=[x for x in d if x >=0]#if (4,3)>(3,4):#    print 'aaaaaaaaaaaa'r=[(y,x) for x,y in s.items()]print sprint rpr...【阅读全文】
可怜的猪头 | 2018-12-29 10:39:37 | 阅读(1980) | 评论(0)
在python中有如下代码:    class father():        def __init__(self,age):            self.age = age;        def get_age(self):          ...【阅读全文】
【LINUX】 python环境变量
可怜的猪头 | 2018-12-15 15:03:53 | 阅读(1740) | 评论(0)
Linux中Python环境变量的设置Python环境变量的查看与添加这种添加python path环境变量的方式,只在当前脚本程序范围内起作用。若要在整个Linux环境中起作用,就要添加设置Linux的PYTHONPATH变量。jxj@ubuntu1:~/TFFRCNN$ pythonPython 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on li...【阅读全文】
zhaotingrui | 2018-11-29 10:27:44 | 阅读(1650) | 评论(0)
[root@localhost ~]# python test.py请输入qwerTraceback (most recent call last):  File "test.py", line 3, in <module>    a = input('请输入')  File "<string>", line 1, in <module>NameError: name 'qwer' is not definedtest.py文件内容如下[root@localhost ~]# cat test.py...【阅读全文】
zhaotingrui | 2018-11-28 22:50:54 | 阅读(1200) | 评论(0)
[root@server testpython]# python server.py  File "server.py", line 8SyntaxError: Non-ASCII character '\xe7' in file server.py on line 8, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details报错原因:因为Python在默认状态下不支持源文件中的编码所致解决办法:#!/us...【阅读全文】
zhaotingrui | 2018-11-23 11:33:20 | 阅读(1990) | 评论(0)
centos7中编辑python脚本时,导入了psutil模块,在执行时出错[root@server ~]# ./hello.pyTraceback (most recent call last):  File "./hello.py", line 2, in     import psutilModuleNotFoundError: No module named 'psutil'【阅读全文】
zds05 | 2018-10-26 11:29:21 | 阅读(0) | 评论(0)
2013年05月04日 08:32:36 liberize 阅读数:23078 标签: Python 相对导入 更多 个人分类: Python 1、绝对导入和相对导入绝对导入:按照sys.path顺序搜索,先主目录(sys.path中第一项''),然后PYTHONPATH环境变量、标准库路径、pth指定路径等。相对导入:在模块所在同一个包内...【阅读全文】
jelon521 | 2018-09-28 19:00:13 | 阅读(5460) | 评论(0)
二叉排序树又称为二叉查找树。它或者是一颗空树,或者是具有下列性质的二叉树:若它的左子树不为空,则左子树上所有节点的值均小于它的根结构的值;若它的右子树不为空,则右子树上所有节点的值均大于它的根结构的值;它的左、右子树也分别为二叉排序树。二叉树的第i层至多有2^{i-1}个结...【阅读全文】
zds05 | 2018-09-28 16:09:33 | 阅读(0) | 评论(0)
#!/usr/bin/python2import osimport sysimport timeimport getoptfrom socket import *file = open("tmp","r")i =0listcid =[]for line in file:    #print line    i = i+1    listcid.append(line)print len(listcid)mSocket=socket(AF_INET,SOCK_DGRAM)...【阅读全文】
mingfei10 | 2018-09-27 22:45:04 | 阅读(1300) | 评论(0)
python中的多进程最大的好处就是充分利用多核cpu的资源,不像python中的多线程,受制于GIL的限制,从而只能进行cpu分配,在python的多进程中,适合于所有的场合,基本上能用多线程的,那么基本上就能用多进程。多进程的类Process和多线程的类Thread差不多的方法,两者的接口基本相同,具体看以下的代码:?...【阅读全文】
mingfei10 | 2018-07-10 05:42:41 | 阅读(2770) | 评论(0)
https://blog.csdn.net/hongbin_xu/article/details/76284134版权声明:本文为博主原创文章,未经博主允许不得转载。https://blog.csdn.net/hongbin_xu/article/details/76284134文章标签: python人脸识别开源个人分类: Python图像处理所属专栏: Python dlib学习...【阅读全文】
huodiewj | 2018-05-04 14:08:57 | 阅读(1180) | 评论(0)
最近要对一系列数据做同比比较,需要用到numpy和pandas来计算,不过使用python安装numpy和pandas因为linux环境没有外网遇到了很多问题就记下来了。首要条件,python版本必须是2.7以上(huodie安装的系统为CentOS Linux release 7.4.1708(Core))。 出自:https://www.cnblogs.com/lxmhhy/p/6029465.html...【阅读全文】
程九十 | 2018-04-11 08:22:56 | 阅读(860) | 评论(0)
这几年对运维人员来说最大的变化可能就是公有云的出现了,我相信可能很多小伙伴公司业务就跑在公有云上,  因为公司业务关系,我个人接触公有云非常的早,大概在12年左右就是开始使用亚马逊云,后来逐渐接触到国内的阿里,腾讯云等,随着公司业务往国内发展,这几年我们也使用了很多国内的公有云厂商,所以在云运维...【阅读全文】