打开文件
open(name[mode[,buffing])
name: 是强制选项,模式和缓冲是可选的
#如果文件不在,会报下面错误:
[python] view plaincopyprint?
>>> f = open(r'D:\text.txt','r')
Traceback (most recent call last):
File "", line 1, in
IOError: [Errno 2] No such file or direc...
分类:
编程语言 时间:
2014-10-01 03:25:00
阅读次数:
516
Follow up the "remove duplicates",what if duplicates are allowed at most twice?思路一:使用变量numlength记录数组中相同数字出现不超过两次所得到的数组长度;code:class Solution {public: ...
分类:
其他好文 时间:
2014-09-30 23:01:00
阅读次数:
171
Description
You may have wondered why most extraterrestrial life forms resemble humans, differing by superficial traits such as height, colour, wrinkles, ears, eyebrows and the like. A few bear n...
分类:
其他好文 时间:
2014-09-30 16:58:17
阅读次数:
182
题目描述:Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoint...
分类:
其他好文 时间:
2014-09-30 00:30:11
阅读次数:
211
在lighttpd网络模型里面我们可以看到以下代码 1 /* accept()s at most 100 connections directly 2 * 3 * we jump out after 100 to give the waiting connections a ch...
分类:
其他好文 时间:
2014-09-29 12:53:40
阅读次数:
160
第10章 | 充电时刻
本章主要介绍模块及其工作机制
------
模块
>>> import math
>>> math.sin(0)
0.0
模块是程序
一个简单的模块
#hello.py
print ("Hello,World!")
>>> import hello
Traceback (most recent call last):
File "", line 1, in
import hello
ImportError: No module n...
分类:
编程语言 时间:
2014-09-28 23:11:56
阅读次数:
485
DescriptionDuring winter, the most hungry and severe time, Holedox sleeps in its lair. When spring comes, Holedox wakes up, moves to the exit of its l...
分类:
其他好文 时间:
2014-09-28 19:37:15
阅读次数:
519
>>> d = {'a':1}>>> print '%s' % 1,d1 {'a': 1}>>> print '%s %s' % 1,dTraceback (most recent call last): File "", line 1, in TypeError: not enough argu....
分类:
编程语言 时间:
2014-09-28 04:29:10
阅读次数:
203
Problem Description
Think about a plane:
● One straight line can divide a plane into two regions.
● Two lines can divide a plane into at most four regions.
● Three lines can divide a plane int...
分类:
其他好文 时间:
2014-09-28 01:35:10
阅读次数:
361
Problem Description
In 2100, since the sea level rise, most of the cities disappear. Though some survived cities are still connected with others, but most of them become disconnected. The governmen...
分类:
其他好文 时间:
2014-09-26 23:38:58
阅读次数:
209