this gist is a part of repo_starred
##python
Adafruit-Raspberry-Pi-Python-Code
- Adafruit library code for Raspberry Pi
| # -*- coding: utf-8 -*-. | |
| import urllib2 | |
| from bs4 import BeautifulSoup | |
| base_url = 'http://www.geekpark.net' | |
| data = {} | |
| f = urllib2.urlopen('http://www.geekpark.net/read/seed') | |
| src = f.read() | |
| soup = BeautifulSoup(src) |
| class Vehicle(object): | |
| """docstring for ClassName""" | |
| def __init__(self): | |
| self.name = 'vehicle' | |
| def __call__(self): | |
| print "travelling by a Vehicle" | |
| def execute(self): | |
| self() |
this gist is a part of repo_starred
##python
Adafruit-Raspberry-Pi-Python-Code
下面是一堆awesome-*列表轮子,想看干货的童靴可以随意打开一个轮子:
| import requests | |
| import json | |
| base_url = "http://172.28.193.221:8000" | |
| project_id = 1 | |
| code_type_id = 36 | |
| def code_api(project_id, code_type_id): | |
| url="/api/v1/codes/project/{project_id}/code-type/{code_type_id}".format(project_id=project_id, code_type_id=code_type_id) |
本贴不是广告!这里有更多!
一开始通读一遍这个很不错,是最简单明确的 Python 教程,最适合快速了解。
| class RegisterView(View): | |
| template_name = 'accounts/simple_form.html' | |
| def get(self, request, form=None): | |
| if not form: | |
| form = forms.RegisterForm() | |
| data = {'title':'Register', 'form':form, 'btn_name':'Register'} | |
| return render(request, self.template_name, data) |
Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.
open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl
You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html
| [General] | |
| loglevel = notify | |
| skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12,127.0.0.0/24,100.64.0.0/10 | |
| bypass-tun = 0.0.0.0/8, 1.0.0.0/9, 1.160.0.0/11, 1.192.0.0/11, 10.0.0.0/8, 14.0.0.0/11, 14.96.0.0/11, 14.128.0.0/11, 14.192.0.0/11, 27.0.0.0/10, 27.96.0.0/11, 27.128.0.0/9, 36.0.0.0/10, 36.96.0.0/11, 36.128.0.0/9, 39.0.0.0/11, 39.64.0.0/10, 39.128.0.0/10, 42.0.0.0/8, 43.224.0.0/11, 45.64.0.0/10, 47.64.0.0/10, 49.0.0.0/9, 49.128.0.0/11, 49.192.0.0/10, 54.192.0.0/11, 58.0.0.0/9, 58.128.0.0/11, 58.192.0.0/10, 59.32.0.0/11, 59.64.0.0/10, 59.128.0.0/9, 60.0.0.0/10, 60.160.0.0/11, 60.192.0.0/10, 61.0.0.0/10, 61.64.0.0/11, 61.128.0.0/10, 61.224.0.0/11, 100.64.0.0/10, 101.0.0.0/9, 101.128.0.0/11, 101.192.0.0/10, 103.0.0.0/10, 103.192.0.0/10, 106.0.0.0/9, 106.224.0.0/11, 110.0.0.0/7, 112.0.0.0/9, 112.128.0.0/11, 112.192.0.0/10, 113.0.0.0/9, 113.128.0.0/11, 113.192.0.0/10, 114.0.0.0/9, 114.128.0.0/11, 114.192.0.0/10, 115.0.0.0/8, 116.0.0.0/8, 117.0.0.0/9, 117.128.0.0/10, 118.0.0.0/11, 118.64.0.0/10, 118.128.0.0 |