Python
文章平均质量分 54
yeyu_xing
╔══╗ ♪
║██║ ♫
║ ( ● ) ♫
╚══╝♪ ♪
展开
-
flask+sqlalchemy+echarts动态显示数据
一、创建测试数据 SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for user -- ---------------------------- DROP TABLE IF EXISTS `user`; CREATE TABLE `user` ( `id` bigint(20) NOT NULL COMMENT '主键ID', `name` var原创 2021-03-30 10:34:42 · 890 阅读 · 2 评论 -
UnboundLocalError: local variable x referenced before assignment
(一):多数情况 a = 1 def test(): a += 1 test() 解决办法: (1):将全局变量作为参数传入 a = 1 def test(a): a += 1 print(a) test(a) (2):在方法中定义局部变量 a = 1 def test(): a = 1 a += 1 print(a) test() (3):使用global关键字 a = 1 def test(): global a a += 1原创 2020-05-18 20:57:10 · 1295 阅读 · 0 评论 -
Python中matplotlib库的基本使用
一、绘制简单折线图 import matplotlib.pyplot as plt import random """ matplotlib入门(绘制折线图) """ x = range(0, 24, 2) print(list(x)) y = [random.randint(23, 34) for num in range(0, 12)] plt.plot(x, y) # 绘制图形 plt.show() 二、绘制折线图并设置刻度 import matplotlib.pyplot as plt i原创 2021-03-10 10:15:41 · 503 阅读 · 1 评论