1.cmd="someunixcommand"
retcode=subprocess.call(cmd,shell=True)2.ssh=paramiko.SSHClient()
ssh.connect(server,username=username,password=password)
ssh_stdin,ssh_stdout,ssh_stderr=ssh.exec_command(cmd_to_execute)3.importspur
shell=spur.SshShell(hostname="loc..
分类:
编程语言 时间:
2015-02-15 23:16:20
阅读次数:
470
#!/usr/bin/perl
#usestrict;
#usewarnings;
useLWP::UserAgent;
useHTTP::Cookies;
useEncode;
useJSON;
useutf8;
binmode(STDIN,‘:encoding(utf8)‘);
binmode(STDOUT,‘:encoding(utf8)‘);
binmode(STDERR,‘:encoding(utf8)‘);
my$new_task_url=‘http://www.alibench.com/ne..
分类:
其他好文 时间:
2015-02-12 14:11:24
阅读次数:
196
from:http://www.cnblogs.com/bluescorpio/archive/2010/05/04/1727020.html最近在用subprocess中的Popen做个磁盘监控小程序,但是在使用ps = Popen("df -h", shell=True, stdout=PIPE...
分类:
编程语言 时间:
2015-02-10 23:09:30
阅读次数:
388
1. 配置在控制台显示日志信息 stdout log4j.rootLogger=info,stdout,logfile log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.ap...
分类:
其他好文 时间:
2015-02-10 13:04:10
阅读次数:
157
三期第五讲 -高级文件管理1.输入输出重定向 ls -l /dev/stdin -> /proc/self/fd/0 标准输入 设备:键盘 标记:0 ls -l /dev/stdout -> /proc/self/fd/1 标准输出 设备:屏幕 标记:1 ls...
分类:
系统相关 时间:
2015-02-05 20:05:44
阅读次数:
245
文件和输入输出
__builtins__模块中和输入输出相关的函数:
print(value,...[,
sep=' ', end='\n', file=sys.stdout, flush=False])
file默认是打印到stdout,也可以重定向到别的地方
sep表示value之间插入的字符串,默认是一个空格
end表示最后一个value之后的内容,默认是换行
f...
分类:
编程语言 时间:
2015-01-30 09:05:22
阅读次数:
214
本例中直接用python写一个MapReduce实例:统计输入文件的单词的词频使用python写MapReduce的“诀窍”是利用Hadoop流的API,通过STDIN(标准输入)、STDOUT(标准输出)在Map函数和Reduce函数之间传递数据。我们唯一需要做的是利用Python的sys.std...
分类:
编程语言 时间:
2015-01-29 20:57:30
阅读次数:
267
#include int main(){ freopen("read.txt", "w", stdout); for(int j=0; j<=1000000000; j+=100) { int tp = j; int seat = 1; int all = 0; while(tp) { all +=...
分类:
其他好文 时间:
2015-01-29 15:52:59
阅读次数:
111
2015.1.27星期二,早晨阴天,中午下雪了今天上午老师不上课,程序语句,记一下:main(void){ int c; while((c = getc(stdin)) != EOF) if(putc(c,stdout) == EOF) 将字符写到标准输出 err_sys("output ...
分类:
其他好文 时间:
2015-01-27 23:28:32
阅读次数:
220
最近在做一个通过WEB调用系统命令的工具,难点是如何获取执行过程,同时可以逐行输出?
想起以前有看到霸爷提到rebar中封装了类似的功能,于是从rebar_utils中整出了下面的东西,很好用。
-module(sh_port).
-export([sh/1, sh/2]).
%%
%% Options = [Option] -- defaults to [use_stdout, abo...
分类:
其他好文 时间:
2015-01-24 11:46:48
阅读次数:
237