随笔分类 - Python
摘要:【problem】 从别处copy过来的python代码经过自己改动后,运行出错 【解决过程】 vim file :set list # cat -A file 也可以 可以看到9-12行的indentaion是TAB,13行是4个空格。 Python语法不支持代码对齐中混用TAB和空格。 vim
阅读全文
摘要: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...
阅读全文
摘要: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 ...
阅读全文
摘要:windows下python IDE我用的是pycharm 在pycharm下安装paramiko import paramiko后提示没有pycrypto这个模块 在pycharm下又安装不上pycrypto(一直报错) 直接下载已编译版: http://www.voidspace.org.uk/
阅读全文
摘要: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...
阅读全文
摘要: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....
阅读全文

浙公网安备 33010602011771号