#<center>python基本语法</center>
##基本用法
###项目基础语法
#####创建django项目
>django-admin startproject xxx
#####创建app目录
>python manage.py startapp app
#####运行项目
>python manage.py runserver 127.0.0.1:8000
#####创建/更新数据库
>python manage.py makemigrations
>
>python manage.py migrate
#####批量加载安装库
>pip install -r plist.txt
***
###SQL使用篇
#####or用法
from django.db.models import Q
|表示或者 &相同调用
Q(question__startswith=’Who’) | Q(question__startswith=’What’)
等同于WHERE question LIKE ‘Who%’ OR question LIKE ‘What%’
#####or用法进阶
from django.db.models import Q
需要引入operator
import operator
for item in cun_d:
#模糊 OR查询
q_list.append(Q(**{'town_name__startswith': item}))
SNCustomerAddress = SNCustomerAddress.objects.filte
python 基础笔记
最新推荐文章于 2021-11-12 19:47:35 发布
本文是关于Python基础的笔记,主要内容包括Django项目的创建、管理及运行,以及SQL查询的使用技巧,如OR操作的实现、各种查询比较符的运用。此外,还介绍了两个基础库的使用:cpca用于省市区识别,jieba用于词组切割。
摘要由CSDN通过智能技术生成