This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"github.com/docker/docker/api/types" | |
"github.com/docker/docker/api/types/filters" | |
"github.com/docker/docker/client" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin python | |
# coding: utf-8 | |
''' | |
Simple Script for iPhone Price. | |
''' | |
__author__ = 'Kollin' | |
class PhoneCost(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"strings" | |
"strconv" | |
"regexp" | |
"io/ioutil" | |
"net/http" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
from django.db.loading import get_model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
re.search('[0-9]','2') #-->True | |
re.search('[0-9]','2a') #-->True | |
re.search('^[0-9]$', '2') #-->True | |
re.search('^[0-9]$', '22') #-->False | |
re.search('^[0-9]{1,2}$', '22') #-->True | |
re.search('^[0-9]{1,}$', '22') #-->True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
actions.get(action)(selected)代码写的不错,干净。 | |
源文件:https://github.com/marconi/django-quickstart/blob/master/src/todo/views.py | |
''' | |
def home(request): | |
todos=Todo.objects.order_by('-created') | |
if request.method == 'POST': | |
action = request.POST['action'].lower() | |
todo_list_form = TodoListForm(data=request.POST, todos=todos) | |
if todo_list_form.is_valid(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#一个简单的装饰器 | |
def require_int(foo): | |
def re(arg): | |
if type(arg)==int: | |
return foo(arg) | |
else : | |
raise 'The arg must int' | |
return re | |
@require_int |