码迷,mamicode.com
首页 >  
搜索关键字:print    ( 43532个结果
基础学习
Datetime:2014-05-0717:04:53PYTHON 号称胶水语言。一,表,元组,字典区别:表:可以修改a=[1,3,4,5]a[2]=5print a#[1,3,5,5]View Code元组:不能被修改a=(1,2,3)a=(a[0],2,a[1])print a#1,2,2#数组...
分类:其他好文   时间:2014-05-08 12:27:37    阅读次数:244
python 向上取整ceil 向下取整floor 四舍五入round
#encoding:utf-8import math#向上取整print "math.ceil---"print "math.ceil(2.3) => ", math.ceil(2.3)print "math.ceil(2.6) => ", math.ceil(2.6)#向下取整print "\nm...
分类:编程语言   时间:2014-05-08 12:11:13    阅读次数:467
boost::bind实践2——来自《Beyond the C++ Standard Library ( An Introduction to Boost )》
直接代码:代码段1: 1 #include 2 #include 3 #include 4 5 class some_class 6 { 7 public: 8 typedef void result_type; 9 void print_string(const ...
分类:编程语言   时间:2014-05-08 09:49:53    阅读次数:368
Linux下获得CPU的信息
1、查看物理cpu个数 cat /proc/cupinfo |grep 'physical id'|sort|uniq|wc -l 2、查看一个cpu的物理核数 cat /proc/cupinfo |grep 'core id'|sort|uniq -c|wc -l 或 cat /proc/cupinfo |grep 'cpu cores'|uniq|awk -F ":" '{print...
分类:系统相关   时间:2014-05-08 04:07:55    阅读次数:483
Gray Code
The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the total number of bits in the code, print the sequence of gr...
分类:其他好文   时间:2014-05-07 06:10:17    阅读次数:370
笨方法学python(6)加分题--列表与字典的区别
这篇对应的是习题39 字典, 可爱的字典 #encoding:utf-8 #列表与字典的区别 #列表 thing = ['name',1,'age','AD','sex'] print thing[1] #print thing['name'] #会报错,列表只能通过整数去访问:TypeError: list indices must be integers, not str stuff...
分类:编程语言   时间:2014-05-07 06:00:20    阅读次数:365
Python中的循环技术
简单谈谈 Python 中容器的遍历和一下小技巧。 1、遍历单个容器      下面代码遍历一个 List 结构,同样适用于 Tuple、Set 结构类型 >>> x = [1, 2, 3, 'p' , 'y'] >>> for v in x: ...     print(x) ... 1 2 3 p y      遍历字典 Dict 结构也是...
分类:编程语言   时间:2014-05-07 04:12:39    阅读次数:395
python里的splitlines详解
t = '''www.jeapedu.com www.chinagame.me www.quanzhan.org ''' print t.splitlines()     Python的split方法函数可以分割字符串成列表,默认是以空格作为分隔符sep来分割字符串。 In [1]: s = "www jeapedu com" In [2]: p...
分类:编程语言   时间:2014-05-07 02:37:08    阅读次数:478
HDU 3507 Print Article(斜率优化DP)
题目链接题意 : 一篇文章有n个单词,如果每行打印k个单词,那这行的花费是,问你怎么安排能够得到最小花费,输出最小花费。思路 : 一开始想的简单了以为是背包,后来才知道是斜率优化DP,然后看了网上的资料,看得还挺懂的,不过我觉得如果以后真遇到斜率DP,要推起来肯定不简单。。。。。网上资料1网上资料2...
分类:其他好文   时间:2014-05-07 00:35:18    阅读次数:424
eclipse/MyEclipse 日期格式、注释日期格式、时区问题
eclipse/MyEclipse 日期格式、注释日期格式、时区问题在eclipse/MyEclipse中,如果你的注释或是运行System.out.print(new java.util.Date());的时候,发现时间和系统的时间差8个小时。那么就可以说明,你的时区和当前时区不对应。我们中国用的...
分类:系统相关   时间:2014-05-06 23:45:28    阅读次数:494
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!