在Django视图函数中经常出现类似于‘ascii‘ codec can‘t decode byte 0xef in position 0: ordinal not in range(128)的错误。 在解决错误之前,首先要了解unicode和utf-8的区别。 unicode指的是万国码,是一种“字...
分类:
其他好文 时间:
2014-09-02 18:16:55
阅读次数:
141
for循环for i in range(): #注意冒号 range中默认从0开始 或者从指定的数字开始 到给定数字的前一个数字结束 递增递减皆是如此 for循环提供变量的自动初始化for i in range(10): print(i,end = ' ')prin...
分类:
编程语言 时间:
2014-09-02 11:45:54
阅读次数:
242
Android is an open-source software stack for a wide range of mobile devices and a corresponding open-source project led by Google. Here you can find t...
分类:
移动开发 时间:
2014-09-02 09:03:44
阅读次数:
250
LeetCode: Partition ListGiven a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.Y...
分类:
其他好文 时间:
2014-09-02 00:05:33
阅读次数:
235
for index, item in enumerate(sequence): process(index, item)列表初始化:multilist = [[0 for col in range(5)] for row in range(3)]用*初始化,出现的问题:http://www.j...
分类:
编程语言 时间:
2014-09-01 19:22:13
阅读次数:
268
function template
std::any_of
template
bool any_of (InputIterator first, InputIterator last, UnaryPredicate pred);
Test if any element in range fulfills condition
Returns true if pr...
分类:
其他好文 时间:
2014-09-01 17:42:13
阅读次数:
285
//给出n和k,求k个不同的正整数,使其中k-1个数能组成平方数,k个数的和为n。有解输出YES,无解输出NO。
# include
# include
# include
# include
using namespace std;
int n,k;
bool judge(int num)
{
int yy=num*num;//k-1个数相加
int kk=n-yy;
...
分类:
其他好文 时间:
2014-09-01 15:36:43
阅读次数:
171
题目Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the o...
分类:
其他好文 时间:
2014-08-31 22:39:31
阅读次数:
324
def partition(A, p, r): j = p+1 for i in range(p+1, r+1): if(A[i] < A[p]): tmp = A[i] A[i] = A[j] A[j] =...
分类:
编程语言 时间:
2014-08-31 18:38:31
阅读次数:
295
tmp = []def bucket_sort(old): for i in range(len(old)): tmp.append([]) for i in old: tmp[int( i * len(old) )].append(i) ...
分类:
编程语言 时间:
2014-08-31 17:10:51
阅读次数:
490