macOS Catalina自带zsh
ly@linfengxudeMacBook-Pro ~ % echo $SHELL
/bin/zsh
def date_range(start_date, end_date): | |
start_date = start_date.date() | |
end_date = end_date.date() | |
dates = [] | |
date = start_date.strftime("%Y-%m-%d") | |
while start_date <= end_date: | |
dates.append(date) | |
start_date = start_date + datetime.timedelta(1) | |
date = start_date.strftime("%Y-%m-%d") | |
return dates |
{
"backgroundImage": null,
"colorScheme": "Frost",
"commandline": "cmd.exe /K C:\\Users\\ly\\miniconda3\\Scripts\\activate.bat C:\\Users\\ly\\miniconda3",
"experimental.retroTerminalEffect": false,
"guid": "{7b0db4b0-2d25-42ee-ba5b-e71f425f7d57}",
"hidden": false,
"icon": "C:\\Users\\ly\\miniconda3\\Lib\\site-packages\\conda\\shell\\conda_icon.ico",
"name": "Anaconda Prompt",
打开终端
export LANG=en_US
xdg-user-dirs-gtk-update
from rest_framework.pagination import PageNumberPagination | |
from rest_framework import viewsets, mixins | |
from rest_framework import serializers | |
class NewsSerializer(serializers.ModelSerializer): | |
class Meta: | |
model = News | |
fields = "__all__" |
code | type | province | city | area | ||
---|---|---|---|---|---|---|
0 | 11 | 1 | 北京市 | |||
1 | 1101 | 2 | 北京市 | 市辖区 | ||
2 | 110101 | 3 | 北京市 | 市辖区 | 东城区 | |
3 | 110102 | 3 | 北京市 | 市辖区 | 西城区 | |
4 | 110105 | 3 | 北京市 | 市辖区 | 朝阳区 | |
5 | 110106 | 3 | 北京市 | 市辖区 | 丰台区 | |
6 | 110107 | 3 | 北京市 | 市辖区 | 石景山区 | |
7 | 110108 | 3 | 北京市 | 市辖区 | 海淀区 | |
8 | 110109 | 3 | 北京市 | 市辖区 | 门头沟区 |
number | name | |
---|---|---|
110000 | 北京市 | |
110100 | 北京市-市辖区 | |
110101 | 北京市-市辖区-东城区 | |
110102 | 北京市-市辖区-西城区 | |
110103 | 北京市-市辖区-崇文区 | |
110104 | 北京市-市辖区-宣武区 | |
110105 | 北京市-市辖区-朝阳区 | |
110106 | 北京市-市辖区-丰台区 | |
110107 | 北京市-市辖区-石景山区 |
from dateutil.utils import today | |
date = today() | |
print(date) | |
import datetime | |
date = datetime.date.today() | |
print(date) |
def check_ip(ip): | |
compile_ip = re.compile( | |
'^(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|[1-9])\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)$') | |
if compile_ip.match(ip): | |
return True | |
else: | |
return False |