#!/usr/bin/python
##Filename:game.py
fromsysimportexit
fromrandomimportrandint
defdeath():
quips=["1-dead","2-nice","3-luser","4-puppy"]
printquips[randint(0,len(quips)-1)]
exit(1)
#death()
defc_c():
print"Thisisc_cfunction."
action=raw_input(">")
..
分类:
编程语言 时间:
2016-03-09 11:10:37
阅读次数:
248
一.python基础数据类型原始类型:intfloatbyte
复合类型:
由其他原始类型组合起来的类型listdictcuple运算符和表达式:算术运算符:
加/减/乘/除/取模/幂/地板除
+-*/%**//
python2的除:10/float(20)
位运算符[二进制之间的运算]:
bin(60)转换成二进制数int(‘1100‘,2)将二进制..
分类:
编程语言 时间:
2016-03-09 11:10:38
阅读次数:
211
题目描述
输入一个矩阵,按照从外向里以顺时针的顺序依次打印出每一个数字,例如,如果输入如下矩阵: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 则依次打印出数字1,2,3,4,8,12,16,15,14,13,9,5,6,7,11,10.
class Solution {
public:
vector prin...
分类:
编程语言 时间:
2016-03-09 11:07:47
阅读次数:
225
参考文章:http://blog.csdn.net/anonymalias/article/details/11020477 链表定义 1 template <typename Type> 2 struct ListNode{ 3 Type data; 4 ListNode *next; 5 };
分类:
编程语言 时间:
2016-03-09 11:05:55
阅读次数:
456
1、删除和重命名文件 import os import string def replace(file, search_for, replace_with): # replace strings in a text file back = os.path.splitext(file)[0] + ".
分类:
编程语言 时间:
2016-03-09 11:04:11
阅读次数:
230
Example 2.1. odbchelper.py def buildConnectionString(params): """Build a connection string from a dictionary Returns string.""" return ";".join(["%s=%
分类:
编程语言 时间:
2016-03-09 11:01:13
阅读次数:
195
public static void parseZIP(String path,String filename,String resourcePath){ System.out.println("filename:"+filename); String filename0 = filename.su
分类:
编程语言 时间:
2016-03-09 10:59:03
阅读次数:
185
一、求算术平方根 a=0 x=int(raw_input('Enter a number:')) if x >= 0: while a*a < x: a = a + 1 if a*a != x: print x,'is not a perfect square' else: print a else
分类:
编程语言 时间:
2016-03-09 10:58:21
阅读次数:
141
5、Spring支持事务处理 5.1、事务准备 以上代码结构与AOP的前置通知、返回通知、异常通知、后置通知一样。 5.2、声明式事务 5.2.1、基于注解 5.2.2、基于配置文件 5. 3、事务传播属性 5.4、事务其他属性 5.4.1、事务的隔离级别 5.4.2、事物的回滚属性 5.4.3、超
分类:
编程语言 时间:
2016-03-09 10:56:02
阅读次数:
148
6、Spring整合Hibernate 6.1、准备工作 6.2、示例 com.xcloud.entities.book com.xcloud.dao.book com.xcloud.service.book com.xcloud.utils.exception
分类:
编程语言 时间:
2016-03-09 10:54:22
阅读次数:
172
Class-based actorsA class-based actor is a subtype of event_based_actor and must implement the pure virtual member function make_behavior returning th
分类:
编程语言 时间:
2016-03-09 10:53:42
阅读次数:
171
//原码,反码,补码 #include<stdio.h> #include<stdlib.h> //数值的表示方法——原码、反码和补码 //原码:最高位为符号位,其余各位为数值本身的绝对值 //反码: //正数:反码与原码相同 //负数:符号位为1,其余位对原码取反 //补码: //正数:原码、反码
分类:
编程语言 时间:
2016-03-09 10:53:52
阅读次数:
199
1、安装开发者工具包 yum install java-1.7.0-openjdk-devel -y 2、配置环境变量 vim /etc/profile export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.95.x86_64 export C
分类:
编程语言 时间:
2016-03-09 10:53:10
阅读次数:
965
http://blog.csdn.net/lwbeyond/article/details/6202256 一. 什么是拷贝构造函数 首先对于普通类型的对象来说,它们之间的复制是很简单的,例如: int a = 100; int b = a; 而类对象与普通对象不同,类对象内部结构一般较为复杂,存在
分类:
编程语言 时间:
2016-03-09 10:49:43
阅读次数:
168
选择排序/单元排序(Selection Sort) def selSort(L): for i in range(len(L) - 1): print L minIndx = i minVal= L[i] j = i + 1 while j < len(L): if minVal > L[j]: m
分类:
编程语言 时间:
2016-03-09 10:51:47
阅读次数:
197
什么是对象,其实就是一种类型,即引用类型。而对象的值就是引用类型的实例。在ECMAScript中引用类型是一种数据结构,用于将数据和功能组织在一起。它也常被称作为备传统面向对象语言所支持的类和接口等基本结构。 一、Object类型 到目前为止,我们使用的引用类型最多的可能就是Object类型了。虽然
分类:
编程语言 时间:
2016-03-09 10:49:00
阅读次数:
118
@responsebody表示该方法的返回结果直接写入HTTP response body中一般在异步获取数据时使用,在使用@RequestMapping后,返回值通常解析为跳转路径,加上@responsebody后返回结果不会被解析为跳转路径,而是直接写入HTTP response body中。比
分类:
编程语言 时间:
2016-03-09 10:48:13
阅读次数:
129