1 import sys 2 3 4 def count_holes(letter): 5 hole_2 = ['A', 'D', 'O', 'P', 'Q', 'R'] 6 if letter == 'B': 7 return 2 8 elif let...
分类:
其他好文 时间:
2015-05-05 18:32:35
阅读次数:
125
在项目上点击右键->setting->C/C++->Preprocessor definitions
在里面加入自定义预编译头_SB2
测试代码:
include “stdafx.h”include include ifdef _SBprintf("调用了sb\n");
elif _SB2printf("调用了sb2\n");
elseprintf("Hello World!\n");
endifr...
分类:
其他好文 时间:
2015-05-05 12:35:56
阅读次数:
94
1、不想说了、有机会在写#!/bin/bash
cd/root/test
fornamein`ls`
do
if[-d$name]
then
mv/root/test/$name/*.mp4/root/test/key_$name.mp4
mv/root/test/$name/my
elif[[${name:0:4}-ne‘key_‘]]
then
mv$namekey_$name
else
echo$name>1.log
fi
done
分类:
系统相关 时间:
2015-05-04 20:24:44
阅读次数:
141
python有多少关键字?>>> import keyword>>> keyword.kwlist['and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec',...
分类:
编程语言 时间:
2015-05-04 11:38:53
阅读次数:
158
#!/usr/bin/env python
# -*- coding: utf-8 -*-
age = 3
if age >= 18:
print 'adult'
elif age >= 6:
print 'teenager'
else:
print 'kid'
print '----------------------'
names = ['jie', 'bob', 'trcy']
f...
分类:
编程语言 时间:
2015-05-02 01:07:38
阅读次数:
171
linux shell有一套自己的流程控制语句,其中包括条件语句(if),循环语句(for,while),选择语句(case)。下面我将通过例子介绍下,各个语句使用方法。一、shell条件语句(if用法)if语句结构[if/then/elif/else/fi]if 条件测试语句 thenaction...
分类:
系统相关 时间:
2015-04-27 11:08:42
阅读次数:
208
当初学 Python 时,想要弄懂 Python 的错误信息的含义可能有点复杂。这里列出了常见的的一些让你程序 crash 的运行时错误。1)忘记在 if , elif , else , for , while , class ,def 声明末尾添加 :(导致 “SyntaxError :inval...
分类:
编程语言 时间:
2015-04-25 15:04:10
阅读次数:
162
假设有如下代码需要兼容三个版本
这样无法完成任务的
无论
typedef enum{
FIRST,
SECOND,
THIRD,
};
#define NUM THIRD
#if (NUM == FIRST)
#define VAR 1
#elif(NUM == SECOND)
#define VAR 2
#elif(NUM == THIRD)
#defi...
分类:
其他好文 时间:
2015-04-24 01:07:29
阅读次数:
115
第一个是判断素数,先上代码吧: 1 from math import sqrt 2 def is_prime(i): 3 if i == 2: 4 return True 5 elif i list[e+1]: list[e],list[e+1...
分类:
编程语言 时间:
2015-04-22 00:01:12
阅读次数:
349
1、条件:age = 3if age >= 18: print 'adult'elif age >= 6: print 'teenager'else: print 'kid'不能少了: elif2、循环一种是for ...in...names = ['Machael','Bob',...
分类:
编程语言 时间:
2015-04-19 17:27:18
阅读次数:
158