异常处理的目的是防止用户看到不友好的异常情况,避免程序异常退出一.通过try...except...将异常截获,保证程序继续执行try:
open(‘test.txt‘,‘r‘)
1/0
exceptZeroDivisionError,e:
printe
print‘done‘运行以上程序直接抛出异常如下,第2行之后的语句没有被执行,程序直接退出&g..
分类:
编程语言 时间:
2015-07-22 11:02:42
阅读次数:
137
一直在学习,也一直在忘记,今天借助这篇博文,记录下自己学习过程中的一些最基础的东西!1、for#!/bin/bash
foriin{1..10}
do
echo$i
done扫描目标网段中活动的ip#!/bin/bash
foripin192.168.1.{1..255};
do
ping$ip-c2&>/dev/null;
if[$?-eq0];
then
echo$ipi..
分类:
系统相关 时间:
2015-07-21 15:24:35
阅读次数:
132
#设定用户90天修改密码,提前7天提醒
UserList=$(ls/home/|awk‘{print$NF}‘|grep-vlost+found)
foruserin$UserList
do
chage-M90-W7$user
done
#禁ping
echo1>/proc/sys/net/ipv4/icmp_echo_ignore_all
#设定用户过期时间90默认密码长度8位
cp/etc/login.defs/etc/login.def..
分类:
其他好文 时间:
2015-07-21 15:17:54
阅读次数:
164
转自:http://hi.baidu.com/%CE%D2%D2%AA_%D1%A7_%CF%B0/blog/item/b3b5e723bb2ed1265243c1e4.html读文件的方法:第一步:将文件的内容通过管道(|)或重定向(<)的方式传给while第二步:while中调用read将文件内...
分类:
系统相关 时间:
2015-07-18 21:09:11
阅读次数:
194
git clone时,出现这个错误.
remote: Counting objects: 4592517, done.
remote: Compressing objects: 100% (1140430/1140430), done.
error: RPC failed; result=56, HTTP code = 2008.82 MiB | 4.72 MiB/s
f...
分类:
其他好文 时间:
2015-07-18 18:38:55
阅读次数:
118
for for 列表用法 for variable1 in {1..5} do done 不带列表 for varibale in "$@" do done 可以看到, 不带列表的, 与带列表的区别不大 类C风格 for (( integer=1; integer= 10)) then break ...
分类:
其他好文 时间:
2015-07-15 22:40:43
阅读次数:
204
Mads Mobæk:给UINavigationBar添加按钮的示例代码
1
2
3
4
5
6
7
8
UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithTitle:@"Done"
style:UIBarButtonItemStyleDone target...
分类:
其他好文 时间:
2015-07-15 19:26:55
阅读次数:
199
I got the following error message when trying to open a network interface for capture using Wireshark on Mac OS X (Wireshark 1.5.1 Intel 64 beta and 1...
分类:
系统相关 时间:
2015-07-15 10:40:17
阅读次数:
270
1.sh -x script
这将执行脚本并显示所有变量的值如,脚本:#!/bin/bash
#a test about shift
if [ $# -le 0 ]
then
echo "there is no parameters"
exit 0
fi
sum=0
while [ $# -gt 0 ]
do
sum=`expr $sum + $1`
shift
done
echo $su...
分类:
系统相关 时间:
2015-07-14 13:36:28
阅读次数:
169
1.首先我们二话不说直接先看报错内容如下:07-12 08:25:03.572: E/dalvikvm(3602): native fork pid:0 done.07-12 08:25:03.582: E/dalvikvm(3602): threadid=6: created from inter...
分类:
移动开发 时间:
2015-07-12 09:35:18
阅读次数:
173