摘要:
在学习django web开发指南时,发布新博客点击save后会有error提示:no such table balabalabala...百度了一下说重新运行manage.py syncdb 就可以,我试了还是报错,然后仔细看了下提示信息,发现是版本问题,并且他也给出了解决方法:运行'manage... 阅读全文
摘要:
题目:there are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays.The overall run time complexity s... 阅读全文
摘要:
原题:Given a string, find the length of the longest substring without repeating characterFor example, the Longest substring without repeating letters fo... 阅读全文
摘要:
原题:You are given two linked lists representing two non-negative numbers.The digits are stored in reverse order and each of their nodes contain a singl... 阅读全文
摘要:
所有字符串匹配算法的核心问题是,当出现不匹配时,如何向后移动模式串一、暴力匹配算法 如果要匹配一个字符串s 和一个模式串p,则从i=0开始依次匹配s[i:(i+len(p))],简单粗暴,代码如下:def matcher(t, p): # param t: the string to chec... 阅读全文
摘要:
6、collections 模块还提供有OrderedDict,用于获取有序字典import collectionsd = {'b':3, 'a':1,'x':4 ,'z':2}dd = collections.OrderedDict(d)for key, value in dd.items(): ... 阅读全文
摘要:
1、如果想得到一个列表的index和内容,可以通过enumerate快速实现drinks = ['coffee','tea', 'milk', 'water']for index, drink in enumerate(drinks): print ('Item {} is {}'.forma... 阅读全文
摘要:
判断字符串是否是回文的,即是否中心对称的:>>>return s[::-1] == s对称返回True, 否则返回False 阅读全文
摘要:
1\string are immutable, which means you can't change an existing string.>>>greeting = 'Hello world!'>>>greeting[0] = 'J'TypeError: object does not sup... 阅读全文
摘要:
毕业论文什么的终于搞完了,重拾我的pythonCreating the python skeleton project directory$ mkdir project$ cd project$ mkdir skeleton$ cd skeleton$ mkdir bin$ mkdir Name$ ... 阅读全文