随笔分类 -  Python

摘要:待续 阅读全文
posted @ 2017-08-18 13:58 metasequoia 阅读(131) 评论(0) 推荐(0)
摘要:【problem】 从别处copy过来的python代码经过自己改动后,运行出错 【解决过程】 vim file :set list # cat -A file 也可以 可以看到9-12行的indentaion是TAB,13行是4个空格。 Python语法不支持代码对齐中混用TAB和空格。 vim 阅读全文
posted @ 2016-09-02 14:28 metasequoia 阅读(644) 评论(0) 推荐(0)
摘要:1 # shell 2 last | cut -d ' ' -f 1 | sort -u 1 #python 2 from subprocess import Popen,PIPE 3 4 p1 = Popen('last',shell=True,stdout=PIPE) 5 6 p2 = Popen('cut -d ' ' -f 1,shell=True,stdin=p1... 阅读全文
posted @ 2014-06-04 09:49 metasequoia 阅读(459) 评论(0) 推荐(0)
摘要:1 __author__ = 'metasequoia' 2 # -*- coding: utf-8 -*- 3 import fileinput 4 5 def Count(): 6 count_num = 0 7 for line in fileinput.input('E:\\Python\\Spider\MyCreepy.py'): 8 ... 阅读全文
posted @ 2014-06-03 18:01 metasequoia 阅读(262) 评论(0) 推荐(0)
摘要:windows下python IDE我用的是pycharm 在pycharm下安装paramiko import paramiko后提示没有pycrypto这个模块 在pycharm下又安装不上pycrypto(一直报错) 直接下载已编译版: http://www.voidspace.org.uk/ 阅读全文
posted @ 2014-05-27 14:12 metasequoia 阅读(597) 评论(0) 推荐(0)
摘要:1 #!/usr/bin/env python 2 # -*- coding: utf-8 -*- 3 import urllib2 4 import json 5 import subprocess 6 import threading 7 8 #统计10个最频繁访问的ip 9 ip_raw = subprocess.Popen("cut -d ' ' -f1 host.a... 阅读全文
posted @ 2014-05-27 10:44 metasequoia 阅读(320) 评论(0) 推荐(0)
摘要:1 # -*- coding: utf-8 -*- 2 __author__ = 'metasequoia' 3 4 import fileinput 5 def file_input(): 6 for line in fileinput.input('E:\\Python\\Spider\MyCreepy.py'): 7 num = fileinput.... 阅读全文
posted @ 2014-05-16 12:03 metasequoia 阅读(219) 评论(0) 推荐(0)