• 欢迎访问我的个人博客网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站。
  • 如果您觉得本站对您有用,那么赶紧使用Ctrl+D收藏吧!
  • 相关内容持续完善中......
笨方法学python-习题13:参数、解包、变量

笨方法学python-习题13:参数、解包、变量

练习: 123456from sys import argv script,first,second,third = argv print"The script is called:",script print"Your first variable is:",first print"Your second ……

笨方法学python-习题12:提示别人

笨方法学python-习题12:提示别人

练习: 1234age=raw_input("How old are you?") height=raw_input("How tall are you?") weight=raw_input("How much do you weight?") print"so,you're %r ol……

笨办法学python—习题11:提问

笨办法学python—习题11:提问

练习: 1234567print"How old are you?", age=raw_input() print"How tall are you?", height=raw_input() print"How much do you weight?", weight=raw_input() pr……

shell脚本:抓包脚本

shell脚本:抓包脚本

写了一个抓包脚本,放在rc.local和crontab中。默认按天分割,特殊情况下按具体时刻分割。 123456789101112131415#!/bin/bash if ps -ef | grep -v grep |grep tcpdump &> /dev/null;then     kill `ps -ef|grep -……

笨办法学python-习题10:那是什么?

笨办法学python-习题10:那是什么?

练习: 12345678910111213tabby_cat = "\tI'm tabbed in." persian_cat = "I'm split\non a line." backslash_cat = "I'm \\ a \\ cat." fat_cat = ""&qu……

打印乘法口诀表

打印乘法口诀表

要求:打印乘法口诀表 脚本: 1234567#!/bin/bash for i in `seq 1 9`;do for ((j=1;j<=i;j++));do echo -e "$i*$j=$(($i*$j)) \c" done echo done ……

笨办法学python-习题9:打印,打印,打印

笨办法学python-习题9:打印,打印,打印

习题: 1234567891011#Here's some new strange stuff,remember type it exactly. days = "Mon Tue Wed Thu Fri Sat Sun" months = "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug"……

shell习题:自定义rm

shell习题:自定义rm

linux系统的rm命令太危险,一不小心就会删除掉系统文件。 写一个shell脚本来替换系统的rm命令,要求当删除一个文件或者目录时,都要做一个备份,然后再删除。下面分两种情况,做练习: 1. 简单 假设有一个大的分区/data/,每次删除文件或者目录之前,都要先在/data/下面创建一个隐藏目录,以日期/时间命名,比如/data/.201703271012……

笨办法学python-习题8:打印,打印

笨办法学python-习题8:打印,打印

练习: 123456formatter = "%r %r %r %r" print formatter % (1,2,3,4) print formatter % ("one","two","three","four") print formatter % (……

笨方法学python-习题7:更多打印

笨方法学python-习题7:更多打印

练习: 12345678910111213141516171819print "Mary had a little lamb." print "Its fleece was white as %s." % 'snow' print "And everywhere that Mary went." p……

笨办法学python-习题6:字符串(string)和文

笨办法学python-习题6:字符串(string)和文

练习: 1234567891011121314x = "There are %d types of people." % 10 binary = "binary" do_not = "don't" y = "Those who know %s and those who %s."……

shell脚本:监控80端口

shell脚本:监控80端口

需求: 写一个脚本,判断本机的80端口是否开启着,如果开启着什么都不做,如果发现端口不存在,那么重启一下httpd服务,并发邮件通知你自己。脚本写好后,可以每一分钟执行一次。 脚本: 123456789#!/bin/bash while :;do lsof -i :80 &> /dev/null if [ $? -ne 0 ];then ser……

笨办法学python-习题5:更多的变量和打印

笨办法学python-习题5:更多的变量和打印

练习: 123456789101112131415my_name = 'Zed A. Shaw' my_age = 35 # not a lie my_height = 74 # inches my_weight = 180 # lbs my_eyes = 'Blue' my_teeth = 'White' my_hair = 'Brown' print &……

shell脚本:批量更改文件名

shell脚本:批量更改文件名

需求: 找到/123目录下所有后缀名为.txt的文件 批量修改.txt为.txt.bak 把所有.bak文件打包压缩为123.tar.gz 批量还原文件的名字,即把增加的.bak再删除 123456789#!/bin/bash mkdir /123/tar find /123/ -type f -name "*.txt" >/123……

笨办法学python-习题4:变量(variable)和命名

笨办法学python-习题4:变量(variable)和命名

练习: 1234567891011121314cars = 100 space_in_a_car = 4.0 drivers = 30 passengers = 90 cars_not_driven = cars - drivers cars_driven = drivers carpool_capacity = cars_driven * space_in……

笨办法学python-习题3:数字和数学计算

笨办法学python-习题3:数字和数学计算

笨办法学python-习题3:数字和数学计算 练习: print “I will now count my chickens:” print “Hens”,25 + 30 / 6 print “Roosters”,100 – 25 * 3 % 4 print “N……

笨办法学python-习题2:注释和井号

笨办法学python-习题2:注释和井号

练习: 12345678910# A coment,this is so you can read your program later. # Anything after the # is igored by python. print "I could have code like this." # and the comment a……

笨办法学python-习题1:第一个程序

笨办法学python-习题1:第一个程序

练习: print “Hello World!” print “Hello Again” print “I like typing this.” print “This is fun.” print ‘Yay! Printing.’ pri……