How to split string in Python?

发布时间 2016年06月30日 分类: Python

Split string with identical separator

path = '45.63.130.248:15+221.160.226.9:329+101.240.154.40:1197'

nodes = path.split('+')

print nodes
['45.63.130.248:15', '221.160.226.9:329', '101.240.154.40:1197']
path = '45.63.130.248:15*+221.160.226 …

阅读全文

Django Template Include and I18n

发布时间 2016年01月27日 分类: Python • 标签: Django

In Django template we can use include to include another template into current template, and at the same time we can pass parameters to included tempalte.

{% include "include/another_template.html" with text='I love Python' %}

Sometimes, we need to tranalte include prarameters, this can not be done in another_template.html …


阅读全文

Python Modules, Packages and Import

发布时间 2016年01月16日 分类: Python

Modules in Python are simply Python files with the .py extension, which implement a set of functions. Modules are imported from other modules using the import command.

To import a module, we use the import command. Check out the full list of built-in modules in the Python standard library here …


阅读全文

How to write Markdown

发布时间 2016年01月15日 分类: Post

Basic

Paragraphs

Paragraphs in Markdown are just one or more lines of consecutive text followed by one or more blank lines.

On July 2, an alien mothership entered Earth's orbit and deployed several dozen saucer-shaped "destroyer" spacecraft, each 15 miles (24 km) wide.

On July 3, the Black Knights …

阅读全文