- 博客(8)
- 收藏
- 关注

原创 django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
问题如下:解决方法:我的python是3.7版本,所以在命令行进行安装(如果django配置的虚拟环境,请先进入虚拟环境)pip install pyMySQL接着在django的__init__.py输入并保存import pymysqlpymysql.install_as_MySQLdb()最后验证下,没有再报错。...
2019-01-10 19:54:02
5957
原创 Python 3 AttributeError: module 'pip' has no attribute 'pep425tags'
如图:错误:import pipprint(pip.pep425tags.get_supported())正确: import pip._internal print(pip._internal.pep425tags.get_supported()) [('cp37', 'cp37m', 'win_amd64'), ('cp37', 'none', 'win_amd64'), ...
2019-01-09 22:04:43
2812
3
原创 Django中templates过滤器
使用:{{value | filter}}{{vlue | filter1 | filter2 | filter3 | …}}以django中html文件示例:<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Edit
2019-01-08 12:06:24
282
原创 python写入文件
说明:这里我们在桌面创建一个doc文档,并且写入 ‘Hello,world!’,代码如下:with open ('/Users/GAO/Desktop/test.doc','w')as g: g.write('Hello,world!') g.close()结果:完。...
2018-11-16 10:14:44
3836
原创 python if语句判断
直接上代码:x=int(input("请输入x的坐标:"))y=int(input("请输入y的坐标:"))if(x==0 and y==0):print("位于原点")elif(x==0):print("位于y轴")elif(y==0):print("位于x轴")elif(x>0 and y>0):print("位于第一象限")elif(x&am
2018-11-02 14:27:36
1871
原创 python求一元二次方程的解
求解:X**2+5X+6=0import math a=1;b=5;c=6x1=(-b+math.sqrt(b*b-4*a*c))/(2*a)x2=(-b-math.sqrt(b*b-4*a*c))/(2*a)print('方程x*x+5*x+6=0的解为: ',x1,x2)下面为测试结果:
2018-11-02 13:29:35
8404
1
原创 python求圆的周长和面积
开门见山,代码如下:import mathr=float(input("请输入圆的半径r: "))p=2*math.pi*r #圆的周长S=mat.pi*r**2 #圆的面积print("圆的周长是: ",p)print("圆的面积是: ",s)...
2018-11-02 11:38:42
63815
3
原创 python求三角形面积
Python第一课目前正在自学python,上来做点笔记。题目:已知三条边,如何求一个三角形的面积?在这里插入代码片```import matha=4.0b=3.0c=5.0d=(a+b+c)/2s=math.sqrt(d*(d-a)*(d-b)*(d-c))print (s)...
2018-11-02 10:59:52
24287
2
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人