摘要: 对于文本压缩,据说bzip的算法要优于gzip,从而拥有更好的压缩比。特地找了两个文件来做一下测试,以下为测试结果:(1)源文件为591MB, .tar.bz2文件为61MB(10.32%), .tar.gz文件为92MB(15.57%)(2)源文件为427MB,.tar.bz2文件为43MB(10... 阅读全文
posted @ 2015-06-25 18:46 arun_yh 阅读(487) 评论(0) 推荐(0)
摘要: %r用rper()方法处理对象%s用str()方法处理对象有些情况下,两者处理的结果是一样的,比如说处理int型对象。例一:print"Iam%dyearsold."%22print"Iam%syearsold."%22print"Iam%ryearsold."%22返回结果:Iam22yearso... 阅读全文
posted @ 2015-06-25 18:30 arun_yh 阅读(443) 评论(0) 推荐(0)
摘要: 遍历数组的python代码其他语言中,比如C#,我们通常遍历数组是的方法是:inti = 0; i < list.Length; i++){//todo with list[i]}在Python中,我们习惯这样遍历:insequence: process(item)这样遍历取不到item的序号i,所... 阅读全文
posted @ 2015-06-24 09:13 arun_yh 阅读(300) 评论(0) 推荐(0)
摘要: 单碟的相对来说传输速度快些,但是寻道时间上,多碟的却有优势,这个不能一概而论的说单碟容量越大越好,单碟容量大速度快,发热低。有些硬盘500G 是单碟500G的就比同样500G但是单碟容量是320G的要好相对来说,盘片越少越好。相同容量的话,盘片少说明技术含量高。另外,盘片少的话,功率消耗也小,磁头数... 阅读全文
posted @ 2015-06-20 09:39 arun_yh 阅读(1017) 评论(0) 推荐(0)
摘要: 如果要将一个string list转换成int list (list里每个string都转成int),比如[python] ['0','1','2'] -> [0,1,2] 可以使用:[python] [int(x) for x in list] 或者使用map操作: map(func, list)... 阅读全文
posted @ 2015-06-15 19:09 arun_yh 阅读(486) 评论(0) 推荐(0)
摘要: 测试一段代码的运行时间,在python里面有个很简单的方法,就是使用timeit模块,使用起来超级方便下面简单介绍一个timeit模块中的函数主要就是这两个函数:1, timeit(stmt='pass', setup='pass', timer=, number=1000000) 返回: ... 阅读全文
posted @ 2015-06-15 17:35 arun_yh 阅读(7524) 评论(0) 推荐(0)
摘要: 文件名 -> inode -> device block转自:http://www.ruanyifeng.com/blog/2011/12/inode.htmlhttp://blog.s135.com/post/295/http://hi.baidu.com/leejun_2005/blog/ite... 阅读全文
posted @ 2015-02-05 19:19 arun_yh 阅读(227) 评论(0) 推荐(0)
摘要: 写在前面:案例、常用、归类、解释说明。(By Jim)使用函数#!/bin/bash# testing the scriptfunction myfun { echo "This is an example of a function"}count=1while [ $count -le 5 ]d... 阅读全文
posted @ 2015-01-07 15:42 arun_yh 阅读(310) 评论(0) 推荐(0)
摘要: 我的linux在调整分区后,出现了grub rescue>这表示grub2的配置文件坏了,由于分区调整或分区UUID改变造成GRUB2不能正常启动,从而进入修复模式(grub rescue)也称救援模式。在救援模式下只有很少的命令可以用:set , ls , insmod , root , pref... 阅读全文
posted @ 2014-12-24 14:18 arun_yh 阅读(3803) 评论(0) 推荐(0)
摘要: 用UltraISO Premium Edition 9.3 制作的CentOS 6.4 U盘安装盘,制作过程参考我写的百度经验:UltraISO制作U盘系统盘安装CentOS经验分享安装时提示Press the key to begin the installation process,但是按回车... 阅读全文
posted @ 2014-12-24 14:17 arun_yh 阅读(881) 评论(0) 推荐(0)