随笔分类 -  python

摘要:from flask import Flask,request,render_template,make_response,redirectfrom flask_sqlalchemy import SQLAlchemyimport pymysql#pymysql视为mysqlDBpymysql.in 阅读全文
posted @ 2019-12-10 23:38 灰色轨迹8554 阅读(298) 评论(0) 推荐(0)
摘要:3.定义模型 1.数据库 和 框架的配置 1.安装 SQLAlchemy pip3 install sqlalchemy pip3 install flask-sqlalchemy 2.创建数据库 create database flask default charset utf8 collate 阅读全文
posted @ 2019-12-10 21:05 灰色轨迹8554 阅读(165) 评论(0) 推荐(0)
摘要:def fn(): # global num num = 10 print(num) def func(): # num = 10 print(num) return funcfunc=fn()func()def father(money): def son(someone): print('和%s 阅读全文
posted @ 2019-11-20 23:08 灰色轨迹8554 阅读(118) 评论(0) 推荐(0)
摘要:数字类型 '''1. 整型a1 = 10a2 = int(20) 2. 长整型(py2特有,py3废弃)b1 = 12345678901234567890b2 = long(100) 3. 浮点型c1 = 3.14c2 = float(5.12) 4. 复数类型d = 2 + 3j''' '''总结 阅读全文
posted @ 2019-10-25 09:51 灰色轨迹8554 阅读(219) 评论(0) 推荐(0)
摘要:国际化setting配置 LANGUAGE_CODE = 'zh-hans'TIME_ZONE = 'Asia/Shanghai'USE_I18N = TrueUSE_L10N = TrueUSE_TZ = Falsesetting中间件 MIDDLEWARE = [ 'django.middlew 阅读全文
posted @ 2019-10-23 23:56 灰色轨迹8554 阅读(133) 评论(0) 推荐(0)
摘要:from testcase1 import countimport unittestclass MyTest(unittest.TestCase): def setUp(self): print('test start') def tearDown(self): print('test end')c 阅读全文
posted @ 2019-10-23 09:04 灰色轨迹8554 阅读(163) 评论(0) 推荐(0)