码迷,mamicode.com
首页 >  
搜索关键字:python objects all    ( 160304个结果)
[leetcode]Anagrams
AnagramsGiven an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.编程珠玑中的一道题,书中的解法很巧妙,我就直接搬来用了,时...
分类:其他好文   时间:2014-08-01 22:37:32    阅读次数:162
查看和关闭端口
查看netstat -anptcp 0 0 127.0.0.1:8000 0.0.0.0:* LISTEN 12410/python 关闭kill -9 12410
分类:其他好文   时间:2014-08-01 22:36:52    阅读次数:358
python里两种遍历目录的方法
os.walk函数声明:os.walk(top,topdown=True,onerror=None)(1)参数top表示需要遍历的顶级目录的路径。(2)参数topdown的默认值是“True”表示首先返回顶级目录下的文件,然后再遍历子目录中的文件。当topdown的值为"False"时,表示先遍历子...
分类:编程语言   时间:2014-08-01 22:33:42    阅读次数:254
Python学习之进程和并发
从Python2.4以后,subprocess模块负责衍生出新的进程,和标准输入,标准输出,标准错误输出交互,并监听返回值。Subprocess模块是用来取代一些老的模块,例如os.system,os.spawn,os.popen和popen2In[34]:subprocess.call(‘df-h‘,shell=True) FilesystemSizeUsedAvailUse%Mounted..
分类:编程语言   时间:2014-08-01 20:22:43    阅读次数:462
分享一个查IP归属地的python脚本
今天同事给了6W多个IP叫我查出ISP和归属地,果断用pythonurllib2搞之,数据库用是淘宝的API接口#!/usr/bin/python #coding:utf-8 importurllib2 importjson importtime url=‘http://ip.taobao.com/service/getIpInfo.php?ip=‘ defcheckTaobaoIP(ip): try: response=urllib2...
分类:编程语言   时间:2014-08-01 20:06:12    阅读次数:256
G - UFOs
Description Vasya is a ufologist and his duties include observing Unidentified Flying Objects (UFOs) in the part of space bounded by a cube N × N ×N. The cube is divided into cubic sectors 1 ...
分类:其他好文   时间:2014-08-01 19:58:52    阅读次数:302
nginx 入门配置
先这边文章是为了Django项目的nginx配置 注意点;      以下是/etc/nginx/nginx.conf的内容 include /etc/nginx/conf.d/*.conf;#所以我们可以使用 service nginx start ----如果不需要指定特定的nginx配置 include /etc/nginx/sites-enabled/*;#运行上面的命令时 会加载...
分类:其他好文   时间:2014-08-01 19:43:12    阅读次数:315
使用matplotlib在python中画图
一、安装此处以Ubuntu12.04为例:$ sudo apt-get install ipython python-matplotlib python-numpy二、简单实例>>> plt.figure(1) # 创建图表1>>> plt....
分类:编程语言   时间:2014-08-01 19:33:32    阅读次数:355
python的异常处理及异常类定义
python的异常处理语法和大多数语言相似:try: try块的语句...except exceptiontype1 as var:#使用as语句获得本次捕获到的异常的实例var except块语句...except exceptiontype2 as var: except块语句...exce.....
分类:编程语言   时间:2014-08-01 19:26:02    阅读次数:255
python
#coding=utf-8#序列操作#序列包含 字符串,列表,元组list1=['Jackie', 'Tom', 'Jim', 'Lily', 'Jim']list1[int] #获取下标为int的元素list1[a,b]#获取从下标啊a到下标b的元素集合list1*expr #序列重复expr次l...
分类:编程语言   时间:2014-08-01 19:06:02    阅读次数:238
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!