#!/usr/bin/pythonimportsysimportosiflen(sys.argv)==1:data=sys.stdin.read()else:try:fn=sys.argv[1]exceptIndexError:print"pleasefollowaargumentat%s"%__file__sys.exit()ifnotos.path.exists(fn):print"%sisnotexits."%fnsys.exit()fd=open(sys.argv[1])data=fd.read()c..
分类:
编程语言 时间:
2016-05-29 23:25:57
阅读次数:
197
C风格的输入输出 (1) int getchar() 与 int putchar(int c) getchar从stdin输入流中读取字符,每次只能读取一个字符。若想一次性读取多个字符,则可将其放入循环中。getchar读取所有类型的字符,包括空格。 putchar将一个字符打印到屏幕上,每次只能打 ...
分类:
编程语言 时间:
2016-05-25 07:06:10
阅读次数:
196
debian(kaliLinux)安装netCorecurl-sSLhttps://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview1/scripts/obtain/dotnet-install.sh|bash/dev/stdin--version1.0.0-preview1-002702--install-dir~/dotnet出现错误:dotnet_install:Error:Unabletolocatelibunwind.Inst..
分类:
Web程序 时间:
2016-05-23 19:17:40
阅读次数:
194
stdin、stdout、stderr 1 stdin键盘 2 stdout显示器 3 stderr错误 ...
分类:
其他好文 时间:
2016-05-22 20:05:32
阅读次数:
104
转自http://www.ruanyifeng.com/blog/2011/11/eof.html 学习C语言的时候,遇到的一个问题就是EOF。 它是end of file的缩写,表示"文字流"(stream)的结尾。这里的"文字流",可以是文件(file),也可以是标准输入(stdin)。 比如, ...
分类:
其他好文 时间:
2016-05-21 11:26:27
阅读次数:
183
#!/bin/bash passwd root <<EOF 123456 123456 EOF echo "root:123456" | chpasswd echo '123456' | passwd root --stdin 123456 123456 EOF echo "root:123456" ...
分类:
其他好文 时间:
2016-05-20 17:30:19
阅读次数:
153
包含3种数据流: ?标准输入(stdin):代码为0,符号为<或<<; ?标准输出(stdout):代码为1,符号为>或>>; ?标准错误输出(stderr):代码为2,符号为2>或2>>。 ?>默认为覆盖文件内容,如果要追加则用>> ?>默认为覆盖文件内容,如果要追加则用>> 将数据从指定的流输入 ...
分类:
系统相关 时间:
2016-05-20 13:07:23
阅读次数:
279
一、类型 1. 不可变类型 string, int, tuple 2. 可变类型 list, dict >>> a = "test" >>> a[0] 't' >>> a[0]=e Traceback (most recent call last): File "<stdin>", line 1, ...
分类:
编程语言 时间:
2016-05-20 00:48:54
阅读次数:
229
可以对列和行进行操作,awk有很多内建功能,比如数组,函数等。 结构: awk由3部分构成,begin,end和带模式匹配选项常见语句块。注意这三部分都是被包含在单引号‘ ’或双引号“ ”之间的。 执行步骤: 1,执行BEGIN {commands}语句块中的语句 2,从文件或stdin中读取一行, ...
分类:
其他好文 时间:
2016-05-19 00:02:28
阅读次数:
204
while循环:重复测试某个条件,只要条件成立反复执行条件可以是:测试表达式,也可以是布尔值true(条件永远为真)和false(条件永远为假)viuseradd_while.sh##将下面脚本改写为新建用户的脚本#!/bin/bashPRE=stui=0while[$i-le10];douseradd$PRE$iecho123123|passwd--stdin$P..
分类:
系统相关 时间:
2016-05-17 00:52:37
阅读次数:
395