经常会在项目中用到 int to string
#include
#include
#include
using namespace std;
int main(void)
{
ostringstream num;
num << 123;
string str = num.str();
cout << str << endl;
return 0;
}...
分类:
编程语言 时间:
2014-07-22 23:04:54
阅读次数:
283
WSGI 是Web Services Gateway Interface的缩写. 如果想深入了解,可以阅读 PEP
333 文档,包含有任何你想要的:)community errata, .这篇文章将手把手教你写一个简单的WSGI例子。
注意:我用的Python版本是.2.7.x.
最经典,最简答的WSGI样当属 Hello
World app.
咱们将要用到 v...
分类:
其他好文 时间:
2014-07-22 23:03:53
阅读次数:
407
在Python中内部所有编码都是Unicode,Unicode属于中转码,一般来说,是先把乱码转化为中转码,再转化为我
们需要的编码,转换过程为decode -> unicode -> encode。
#coding:utf-8
#-*- coding:utf-8 -*-
import sys
print sys.getdefaultencoding()
print '中国'
f =...
分类:
编程语言 时间:
2014-07-22 23:03:34
阅读次数:
368
今天学习如何利用Python来解析XML文档。
给定一个XML文件,现在我们用Python来提取里面的内容。
11111111
120
15.0
Python代码:
import xml.etree.ElementTree as ET...
分类:
编程语言 时间:
2014-07-22 23:02:14
阅读次数:
322
[ 问题: ]
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.
If the last word does not exist, return 0.
[...
分类:
其他好文 时间:
2014-07-22 23:01:35
阅读次数:
331
[ 问题: ]
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were
inserted in order. You may assume no duplicates in th...
分类:
其他好文 时间:
2014-07-22 23:01:15
阅读次数:
270
数学和数学计算
print 25+30/6 #25加上30除以6 和为39
print 100-25*3%4 #100减去25乘以3的积再除以4的余数,就是100-3=97
print 100%16 #100除以16的余数=4
print 1/4 #1除以4,然后因为是整数,所以四舍5入为0
print 1.0/4.0 ##1.0除以4.0,因为是浮点数,所以等于0.25
print 3+5...
分类:
编程语言 时间:
2014-05-01 08:22:53
阅读次数:
653
关于最大熵模型的介绍请看:http://www.cnblogs.com/hexinuaa/p/3353479.html
下面是GIS训练算法的python实现,代码不到100行。
from collections import defaultdict
import math
class MaxEnt(object):
def __ini...
分类:
其他好文 时间:
2014-04-30 22:46:39
阅读次数:
384
示例代码将在注册表位置:HKEY_CURRENT_USER\Software\ 读写键值
bool LicenseManage::OpenRegKey(HKEY& hRetKey)
{
if (ERROR_SUCCESS == RegOpenKey(HKEY_CURRENT_USER,"Software", &hRetKey))
{
return true;
...
分类:
其他好文 时间:
2014-04-30 22:12:40
阅读次数:
195