06 2016 档案
摘要:为什么要用Markdown Markdown的资料 后记 本文就是用Markdown写的,软件是macdown,2333
阅读全文
摘要:Mac安装mysql并启动 PS: 两种方式很明显server这种更简单,另外一种实际上可以使用alias简化一下~ Mac install and start redis 参考链接 http://my.oschina.net/jackieyeah/blog/524583 Mac安装py-redis
阅读全文
摘要:Python中对于对象的赋值都是引用,而不是拷贝对象(Assignment statements in Python do not copy objects, they create bindings between a target and an object.)。对于可变对象来说,当一个改变的时
阅读全文
摘要:最早见过手写的,类似于下面这种: 1 import datetime 2 3 def time_1(): 4 begin = datetime.datetime.now() 5 sum = 0 6 for i in xrange(10000000): 7 sum = sum + i 8 end =
阅读全文
摘要:Migrations will run the same way on the same dataset and produce consistent results, meaning that what you see in development and staging is, under th
阅读全文
摘要:返回的数据是列表集合,如 在模板中使用方式如下: 参考见: http://stackoverflow.com/questions/5231171/django-templatesyntaxerror-could-not-parse-the-remainder
阅读全文
摘要:Django做的好出色啊,让人觉得好简单,很多地方都给你写好了,你只需要调用就可以了 比方说刚刚想写博客的归档,就想怎么完成,结果发现通用视图中就有这个,你只需要设置一下就可以了 仅仅几行代码,简直666 比方说月度的归档: url如下: 视图类如下: 模板就用官网的试试就行了: 是不是相当简单呢
阅读全文
摘要:先看代码: 所以,dict['key']只能获取存在的值,如果不存在则触发KeyError 而dict.get(key, default=None)则如果不存在则返回一个默认值,如果设置了则是设置的,否则就是None
阅读全文
摘要:需要的工作有以下三項 Ubuntu Network Manager Client (nmcli)用來建立VPN連線的工具其實在UBUNTU在桌面上就有VPN連線可以用, 為什麼我們還要這麼大費周章的用command line來連呢? 主要是因為我們要用script來做, 才能在crontab 排程中
阅读全文
摘要:如果两个参数不一样长,那么取短的。 也可以反向操作,见下面: 自然,也可以操作三个或者一个参数: python.org的解释: 1. This function returns a list of tuples, where the i-th tuple contains the i-th elem
阅读全文