上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 20 下一页
摘要: 熟悉python的同志们都知道在python中注释的语句是# 但是如果在开头写上# -*- coding: UTF-8 -*-这句注释, 那么这个.py文件就被设置成中文编码。 阅读全文
posted @ 2021-04-13 21:47 帅超007 阅读(431) 评论(0) 推荐(0) 编辑
摘要: 在通过python调用数据库中的内容时,发现其中的内容是没办法直接改变的, 经过查阅资料后发现如果内容存储在tuple中时是无法改变的。 阅读全文
posted @ 2021-04-12 22:28 帅超007 阅读(20) 评论(0) 推荐(0) 编辑
摘要: 你可以根据需求选取各种格式,但是最简单的获取可读的时间模式的函数是asctime(): 一个简单的实例是: import time localtime = time.asctime( time.localtime(time.time()) ) print ("本地时间为 :", localtime) 阅读全文
posted @ 2021-03-27 21:44 帅超007 阅读(203) 评论(0) 推荐(0) 编辑
摘要: json字符串的格式:data = [ { 'a' : 1, 'b' : 2, 'c' : 3, 'd' : 4, 'e' : 5 } ] 在python 中flask向前端传递数据时需要这样写: return jsonify({'data': 4}) 阅读全文
posted @ 2021-03-26 22:33 帅超007 阅读(42) 评论(0) 推荐(0) 编辑
摘要: import pymysql import traceback#获得链接 def get_conn(): conn = pymysql.connect( host="localhost", user="root", passwd="", db="news", charset="utf8" ) cur 阅读全文
posted @ 2021-03-25 07:59 帅超007 阅读(73) 评论(0) 推荐(1) 编辑
摘要: 使用flask和html交互时,需要通过ajax,后端向前端传递数据时可以通过json字符串传递,比如: return jsonify({'data': 1}) 此时前端ajax成功异步请求后会接收到后端传递的数据。 $.ajax({ url: '/newshtml', async: false, 阅读全文
posted @ 2021-03-24 08:01 帅超007 阅读(743) 评论(0) 推荐(0) 编辑
摘要: render_template 是flask中页面跳转的方法,其用法很简单,如下: return render_template("index.html") 这种方法可以传递参数,具体方法如下: return render_template("index.html", msg=session.get 阅读全文
posted @ 2021-03-23 08:10 帅超007 阅读(1688) 评论(0) 推荐(0) 编辑
摘要: flask是一个轻量级,自由度很高的后端。 与web不同,当html想要与flask进行交互时,需要通过ajax进行。 阅读全文
posted @ 2021-03-22 08:27 帅超007 阅读(72) 评论(0) 推荐(0) 编辑
摘要: 这次一鼓作气完成了剩下的内容 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width= 阅读全文
posted @ 2021-03-07 23:06 帅超007 阅读(35) 评论(0) 推荐(0) 编辑
摘要: 这次还是后端上流程上的控制 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="ver 阅读全文
posted @ 2021-03-05 20:02 帅超007 阅读(33) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 20 下一页