单分支if语句if判断条件;then
statement1
statement2
fi双分支if语句if判断条件;then
statement1
statement2
……
else
statement3
statement4
……
fi多分支if语句if判断条件1;then
statement1
statement2
……
elif判断条件2;then
statement3
statement4
……
elif判断条件3;..
分类:
其他好文 时间:
2014-07-08 08:30:58
阅读次数:
166
def q32(n, len):
if n < 0:
return 0
elif n 0:
if n >= 1 and n < 10:
total += 1
return total
p1 = n % (10**(len - 1))
h = n / (10**(len - 1))
...
分类:
编程语言 时间:
2014-07-03 16:04:12
阅读次数:
288
if...else语句:a=3; b=3;if a == b :print(a,b)elif a = 0 and n = 12 and n = 0 and n = 12 and n <= 25): print("hhh")一个字符串也相当于是一个数组,通过for循环可以将每个字符输出for循环,相当...
分类:
编程语言 时间:
2014-07-03 07:01:19
阅读次数:
186
1.if语句(python中没有switch语句,可用if……elif……else代替)格式: if 表达式: #语句 else: #语句eg:number = 23guess = int(raw_input('Enter an integer:'))if guess == numb...
分类:
编程语言 时间:
2014-06-28 11:35:24
阅读次数:
253
今天对条件编译进行了简单回顾. 整理基本语法 以备后来参考.1.#if#if的一般形式是:#if 表达式程序段1#else程序段2# endif# if的执行过程是:如果表达式为真,编译程序段1,否则编译程序段2。作为一种特例,当条件为假不执行任何操作时,可以省略#else。2.#if-#elif-...
分类:
其他好文 时间:
2014-06-24 12:18:36
阅读次数:
203
SHELL学习笔记----IF条件判断,判断条件前言: 无论什么编程语言都离不开条件判断。SHELL也不例外。if list then do something here elif list then do another thing here else do something else here...
分类:
其他好文 时间:
2014-06-14 09:40:46
阅读次数:
204
第一种:#!/bin/bash service vsftpd start &>
/dev/null if[ $? -eq 0 ]thenecho "ftp is start"elseservice vsftpd
startfi第二种:#!/bin/bash read -p "input your f...
分类:
其他好文 时间:
2014-06-02 00:41:38
阅读次数:
332
1.三种控制流语句:if\for\while2.每句后都要加冒号3.有elif语句=else后加一个if注意使用变量名!注意缩进!注意控制流语句后面要加冒号!4.for
i in range(0,5)5.break6.continue=================================...
分类:
编程语言 时间:
2014-05-27 01:01:56
阅读次数:
294
1. if elif else 2. 条件表达式:三元操作符: smaller = x if x
< y else y == if x < y : smaller =x else : smaller = y3. range(start, end,
step=1) 4. xrange(): 当有一个很...
分类:
编程语言 时间:
2014-05-13 21:48:28
阅读次数:
362
1.shell程序格式 #! /bin/bash 首行#!指定shell编译器 # program
除首行的#外,其他的都表示注释 # read var1 read var2 if[ $var1 -eq $var2 ] then echo "$var1 is
equal to $var2" elif...
分类:
其他好文 时间:
2014-05-08 10:36:56
阅读次数:
252