摘要: 阅读全文
posted @ 2020-05-13 22:00 tangqiu 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 实例方法 定义:第一个参数必须是实例对象,该参数名一般约定为“self”,通过它来传递实例的属性和方法(也可以传类的属性和方法); 调用:只能由实例对象调用。 类方法 定义:使用装饰器@classmethod。第一个参数必须是当前类对象,该参数名一般约定为“cls”,通过它来传递类的属性和方法(不能 阅读全文
posted @ 2020-03-29 21:43 tangqiu 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 1、从ssh切换至https git remote set-url origin(远程仓库名称) https://email/username/ProjectName.git 2、从https切换至ssh git remote set-url origin git@email:username/Pr 阅读全文
posted @ 2020-03-25 15:21 tangqiu 阅读(2305) 评论(0) 推荐(0) 编辑
摘要: https://blog.csdn.net/weixin_44141899/article/details/86498326 https://blog.csdn.net/weixin_41973615/article/details/82252501 阅读全文
posted @ 2020-03-25 14:00 tangqiu 阅读(121) 评论(0) 推荐(0) 编辑
摘要: def is_isbn_or_key(word): isbn_or_key='key' ''' isdigit()方法检测字符串是否只由数字组成。 ''' if len(word)==13 and word.isdigit(): isbn_or_key='isbn' short_word=word. 阅读全文
posted @ 2020-03-25 13:53 tangqiu 阅读(298) 评论(0) 推荐(0) 编辑
摘要: format()格式化输出 其实就是format()后面的内容,填入大括号中(可以按位置,或者按变量) '数字{1}{2}和{0}'.format("123",456,'789') >>>'数字456789和123' #可以通过添加关键字参数 '{name}{age}岁'.format(age=22 阅读全文
posted @ 2020-03-25 13:50 tangqiu 阅读(444) 评论(0) 推荐(0) 编辑
摘要: 1、静态方法 import requests class Http: #类的静态方法,调用不需要创建对象,不需要使用self @staticmethod def get(url,return_json=True): r=requests.get(url) if r.status_code==200: 阅读全文
posted @ 2020-03-25 13:46 tangqiu 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 1、目录结构 2、app/__init__.py from flask import Flask from app.api import api from app.web import web ''' 定义APP,注册蓝图 ''' def create_app(): app=Flask(__name 阅读全文
posted @ 2020-03-25 11:23 tangqiu 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 1、hello.py from flask import Flask app=Flask(__name__) @app.route('/hello') def hello(): return 'hello world' if __name__=='__main__': app.run(host='0 阅读全文
posted @ 2020-03-25 10:59 tangqiu 阅读(2027) 评论(0) 推荐(0) 编辑
摘要: 1、安装pipenv pip install pipenv 2、cd 切换到需要使用pipenv 的路径将project 和pipenv 绑定 pipenv install 3、绑定之后,可以安装packages pipenv install flask pipenv install request 阅读全文
posted @ 2020-03-25 10:43 tangqiu 阅读(197) 评论(0) 推荐(0) 编辑