介绍本文介绍在python中读取文件的方法。正文1.f=open(input_file)
forlineinf:
do_stuff(line)f.close()2.forlineinopen(‘myfile‘,‘r‘).readlines():
do_something(line)readlines()读文件的时候会把整个文件一次读到内存,所以这种方法不适合读取大文件。3.importfileinput
f..
分类:
编程语言 时间:
2015-02-15 23:17:22
阅读次数:
373
本文讨论研究在switch case语句中如何使用continue关键字。
一般的switch case语句格式:
switch(?)
{
case num1:
//something
break;
case num2:
//something
break;
case numx:
//something
break;
default:
//default
break;
}
或...
分类:
其他好文 时间:
2015-02-15 09:26:04
阅读次数:
126
When I start reviewing, I thought Chapter is useless. Because the title is “Getting Start” . I thought that is useless. But I found something I miss b...
分类:
编程语言 时间:
2015-02-12 21:26:01
阅读次数:
223
when you learn something, just like learn computer language.if you just learn some basic usage, not master the nature. you will be restricted by the l...
分类:
其他好文 时间:
2015-02-12 08:08:54
阅读次数:
169
取消对代码的修改分为两种情况:第一种情况:改动没有被提交(commit)。这种情况下,使用svn revert就能取消之前的修改。svn revert用法如下:# svn revert [-R] something其中something可以是(目录或文件的)相对路径也可以是绝对路径。当somethi...
分类:
其他好文 时间:
2015-02-11 10:43:06
阅读次数:
209
1. StartingShall we start?Let's get started.Good morning, everyone. Thank you for participating in this meeting.I'm going to show you something really...
分类:
其他好文 时间:
2015-02-09 20:09:44
阅读次数:
227
处理HTML表单通过$_REQUEST['city'];访问,$_REQUESTcity大小写拼写必须要完全相同(name属性值)$_REQUEST是一个特殊的变量类型,称为超全局变量(后面详细讲)if(condition){ //Do something}elseif(condition2){ ....
分类:
数据库 时间:
2015-02-07 21:34:58
阅读次数:
172
#后面写注释加上.0则自动作为float处理输出int:print"He‘s%dpoundsheavy."%my_weight输出String:print"He‘sgot%seyesand%shair."%(my_eyes,my_hair)Usethe%rfordebugging,sinceitdisplaysthe"raw"dataofthevariable,buttheothersareusedfordisplayingtousers.单引号和双引号都..
分类:
编程语言 时间:
2015-02-06 16:56:40
阅读次数:
130
public voidrequestLayout()Since:API Level 1Call this when something has changed which has invalidated the layout of this view. This will schedule a la...
分类:
移动开发 时间:
2015-02-03 17:04:09
阅读次数:
171
When you go shopping, you can search in repository for avalible merchandises by the computers and internet. First you give the search system a name about something, then the system responds with the results. Now you are given a lot merchandise names in rep...
分类:
其他好文 时间:
2015-02-03 15:04:50
阅读次数:
141