本文均来自PythonCookbook,本博文励志将Cookbook中的string部位,文件,面向对象编程部分完成,本系列博文陆续还会介绍flask框架,每篇博文都以一个个小例子展示。#-*-coding:utf-8-*-
‘‘‘
文件相关的操作:
read()
open()
两个参数:
第一个:文件路径
第二个:打开文件的模式
常..
分类:
编程语言 时间:
2014-05-03 02:00:18
阅读次数:
417
BufferGo标准库Buffer是一个可变大小的字节缓冲区,可以用Wirte和Read方法操作它,在Go标准库中,定义了如下关于Buffer的数据结构。typeBufferstruct{
buf[]byte//contentsarethebytesbuf[off:len(buf)]
offint//readat&buf[off],writeat&buf[len(buf)]
runeBytes[utf8...
分类:
其他好文 时间:
2014-05-03 01:30:02
阅读次数:
539
64位系统中,安装freetype时,出现这个问题。后来发现,此问题进出现在64位系统中。
修复方法:
cd zlib-1.2.3 //进入zlib目录
CFLAGS="-O3 -fPIC" ./configure //使用64位元的方法进行编译
make
make install
然后,进入freetyp...
分类:
其他好文 时间:
2014-05-02 23:50:23
阅读次数:
397
Artificial Intelligence?
Physics teachers in high school often think that problems given as text are more demanding than pure computations. After all, the pupils have to read and underst...
分类:
其他好文 时间:
2014-05-02 23:39:35
阅读次数:
485
Lease 的机制:hdfs支持write-once-read-many,也就是说不支持并行写,那么对读写的互斥同步就是靠Lease实现的。Lease说白了就是一个有时间约束的锁。客户端写文件时需要先申请一个Lease,对应到namenode中的LeaseManager,客户端的client name就作为一个lease的holder,即租约持有者。LeaseManager起什么作用呢?
读写过程的容错是怎么做的?数据块是如何复制的?数据块的恢复机制?本文都有涉及。...
分类:
其他好文 时间:
2014-05-02 23:22:14
阅读次数:
450
一,socket 模块
套接字包括两类:服务器,客户机,
创建一个套接字后让它等待连接
服务器:
import socket
s = socket.socket()
port = 1234
host = socket.gethostname()
print host
s.bind((host,port))
s.listen(5)
while True:
get,addr = s...
分类:
编程语言 时间:
2014-05-02 21:59:57
阅读次数:
444
vbs获取当前时间日期的代码,文章来源:脚本学堂。获取当前日期方法一:Currentdate1=date()msgbox
Currentdate1获取当前日期方法二:Currentdate2=year(Now)&"-"&Month(Now)&"-"&day(Now)msgbox
Currentdat...
分类:
其他好文 时间:
2014-05-02 11:27:20
阅读次数:
314
const : 指定字段或者本地变量不能被修改。readonly :
声明一个字段只能在定义的时候赋值或者在构造函数中赋值。( readonly 可以有不同的值,取决于构造函数的值。 const
是一个编译时的常量,readonly是一个运行时的常量,example:public static re...
分类:
其他好文 时间:
2014-05-02 09:26:05
阅读次数:
304
usingSystem;
usingSystem.Collections.Generic;
usingSystem.IO;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Threading.Tasks;
namespace读文件案例
{
classProgram
{
staticvoidMain(string[]args)
{
Console.WriteLine("请输入文件名");
stringfileName=Console.Read..
分类:
其他好文 时间:
2014-05-02 04:00:58
阅读次数:
289
在C++控制台应用程序中可以控制控制台输出的字体颜色和 接受任意按键退出#ifndef
CONSOLE_UTILS_H#define CONSOLE_UTILS_H#include #include #include //default text
colors can be found in win...
分类:
编程语言 时间:
2014-05-02 00:23:19
阅读次数:
450