1. mysql 版本要求 5.5 以上, 否则不支持 emoji 表情.$ sudo apt-get install mysql-server$ sudo vim /etc/mysql/my.cnf # charset utf8mb4. mysql 5.5 required[client]def....
分类:
数据库 时间:
2014-10-18 18:19:41
阅读次数:
218
1 import xlrd 2 import MySQLdb 3 def inMySQL(file_name): 4 wb = xlrd.open_workbook(file_name) 5 sh = wb.sheet_by_index(0) 6 data = [sh.ro...
分类:
数据库 时间:
2014-10-18 11:07:50
阅读次数:
280
1 import MySQLdb 2 import xlwt 3 def outMySQL(file_name): 4 wb = xlwt.Workbook() 5 sh = wb.add_sheet('sheet 1',cell_overwrite_ok=True) 6 7 ...
分类:
数据库 时间:
2014-10-18 11:03:56
阅读次数:
176
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define PI acos(-1.0)
#def...
分类:
其他好文 时间:
2014-10-17 16:54:18
阅读次数:
214
举例:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib
import urllib2
def main():
url = "http://www.douban.com"
#浏览器头
headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 6.1;...
分类:
编程语言 时间:
2014-10-17 16:54:14
阅读次数:
183
我们经常看到各种被双下划线环绕的方法,如__init__,它们就是魔术方法.
魔术方法是python语言预定好的"协议",不同魔术方法在不同场景下,会被隐式调用.我们通过重载这些方法,从而操控各种行为.
class A(object):
def __str__(self):
return "I am A,2333"
def __len__(self):
...
分类:
编程语言 时间:
2014-10-17 15:30:54
阅读次数:
494
1、注意空字符串的处理;2、注意是alphanumeric字符;3、字符串添加字符直接用+就可以; 1 class Solution: 2 # @param s, a string 3 # @return a boolean 4 def isPalindrome(self, ...
分类:
其他好文 时间:
2014-10-17 01:34:53
阅读次数:
216
1.模版方法模式做题的列子:需求:有两个学生,要回答问题,写出自己的答案#encoding=utf-8__author__ = 'kevinlu1010@qq.com'class StudentA(): def answer1(self): print '题目一:XXXXXX' ...
分类:
编程语言 时间:
2014-10-16 22:58:53
阅读次数:
253
def?obj2str(?obj,with_endline=?True?):?
????‘‘‘
??????为了使包含中文的数据结构能够在win32下面正常打印出字符串,将所有的字符串转换为unicode。
????‘‘‘
????new_str?=u‘‘
????...
分类:
编程语言 时间:
2014-10-16 22:30:04
阅读次数:
227
??
4. OOP
4.1. 类class
4.1.1. 定义
例子1:
class User {
var name = "anonymous"
var age:Int = _
val country = "china"
def email = name + "@mail"
}
使用:
val u =...
分类:
其他好文 时间:
2014-10-16 14:56:28
阅读次数:
259