摘要: Flask简单使用 1、定义路由 @app.route('/')是装饰器,定义如下: app.route(rule, options) rule参数:是绑定URL与函数。 options参数:是可选参数。 2、run() 函数来让应用运行在本地服务器上。定义如下 : app.run(host, po 阅读全文
posted @ 2020-07-29 19:41 Guohd 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 1、python反转字符串 '''第一种:使用字符串切片''' s = 'Hello World' print(s[::-1]) # dlroW olleH '''第二种:使用列表的reverse方法''' l = list(s) l.reverse() print( "".join(l) ) # 阅读全文
posted @ 2020-07-06 10:18 Guohd 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 1.1 列表和元组 1、列表基本操作 1. 列表赋值 a = [1,2,3,4,5,6,7,8] a[0] = 100 #the result : [100, 2, 3, 4, 5, 6, 7, 8] 2. 元素删除 a = [1,2,3,4,5,6,7,8] del a[0] #the resul 阅读全文
posted @ 2020-07-06 09:47 Guohd 阅读(149) 评论(0) 推荐(0) 编辑
摘要: cookies,session作用:用户状态保持,告诉服务器你是谁。 migrate指令和makemigrations的差别:makemigrations生成迁移文件,migrate执行迁移文件 cookies:把认为重要的信息放在cookies中在每次交流时都带上1.设置cookie:.获取值.设 阅读全文
posted @ 2019-12-23 10:06 Guohd 阅读(277) 评论(0) 推荐(0) 编辑
摘要: 配置urls导包 from django.urls import path from . import views urlpatterns=[ path('xxx/',views.xxx) ] 配置views导包 from django.shortcuts import render from dj 阅读全文
posted @ 2019-12-19 20:41 Guohd 阅读(128) 评论(1) 推荐(0) 编辑