你可以在python shell按快捷键ctrl+N新建一个*.py脚本,保存后,在文件上点run→run module,即可执行,结果显示在 Python shell里面,或者在你的命令行下直接键入其名字或者 python 其名字
分类:
编程语言 时间:
2015-04-08 13:00:22
阅读次数:
318
(1)在shell下,操作hadoop目录,批量命名或删除,最终的命令sed的正则贪婪替换,看下面的脚本:
Java代码
# 遍历 hadoop 目录下的文件名 for line in `hadoop fs -ls /user/d1 | gawk '{ print $8 }' ` do #echo $line; #将2级目录下的文...
分类:
系统相关 时间:
2015-04-08 09:18:20
阅读次数:
190
1、 try{ return } - catch{}-finally{} 等价于 try{} - catch{ return }-finally{} 这种情况public class Test{
public static void main(String args[]){
int a = getObj() ;
System.out.print(a....
分类:
其他好文 时间:
2015-04-08 09:17:20
阅读次数:
99
题目链接:Gray Code
The gray code is a binary numeral system where two successive values differ in only one bit.
Given a non-negative integer n representing the total number of bits in the code, print th...
分类:
其他好文 时间:
2015-04-07 23:34:18
阅读次数:
318
Exception --> erroruser definedsystem exceptiondeclarebeginexceptionendPL/SQL programtake the input (any number ) from user, print the input in revers...
分类:
数据库 时间:
2015-04-07 23:06:55
阅读次数:
310
#includeusing namespace std;void Print_LCS(int **b, string X, int i, int j){ if (i == 0 || j == 0) return; if (b[i][j] == 1) { ...
分类:
其他好文 时间:
2015-04-07 21:31:26
阅读次数:
114
#!/bin/bash
echo-e"PID\t\tSwap\t\tProc_Name"
forpidin`ls-l/proc|grep^d|awk‘{print$9}‘|egrep-v[a-z]+`
do
#进程id是1为祖进程
if[$pid-eq1];thencontinue;fi#Donotcheckinitprocess
#判断改进程是否占用了swap
grep-q"Swap"/proc/$pid/smaps2>/dev/null
if[$?-eq0];t..
分类:
系统相关 时间:
2015-04-07 20:09:27
阅读次数:
346
创建列表:>>>music=["Abba","RollingStones","BlackSabbath","Metallica"]>>>printmusic输出:[‘Abba‘,‘RollingStones‘,‘BlackSabbath‘,‘Metallica‘]通过join函数通过空格连接列表中的元素:>>>print‘‘.join(music)返回结果AbbaRollingStonesBlack..
分类:
编程语言 时间:
2015-04-07 19:57:11
阅读次数:
154
1,网卡流量监控RateOfFlow.sh#!/bin/bash#while true;dotime=`date +%m"-"%d"-"%k":"%M`day=`date +%m"-"%d`rx_before=`ifconfig eth0|sed -n "7"p|awk '{print $2}'|c...
分类:
系统相关 时间:
2015-04-07 19:22:03
阅读次数:
140
lua中的正则表达式,规则如图:
常用示例,代码如下:
-- 去掉首尾所有空格
function trim(s)
return (string.gsub(s, "^%s*(.-)%s*$", "%1"))
end
local s = " space "
local txt = trim(s)
print(string.len(s), string.len(txt))...
分类:
其他好文 时间:
2015-04-07 17:44:59
阅读次数:
422