![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
予或
ATcys
展开
-
Win10 python双版本共存配置问题 Configuration file could not be loaded.
根据博客配置双版本python共存,重装pip时遇到问题Configuration file could not be loaded.File contains no section headers.file: C:\Users\admin\pip\pip.ini, line: 1' [global]\n'到报错路径下查看pip.ini文件,发现[global]前有空格,删除上下两行的空格即可版本 Python 3.8.6 和 Python 2.7.18...原创 2021-10-28 16:47:12 · 4797 阅读 · 2 评论 -
‘str‘ object has no attribute ‘get‘
我这里是因为函数返回了str,然后在django的views文件中直接return了函数返回值,正确做法应该是将函数返回值通过HttpResponse函数传回。原创 2021-07-11 13:12:48 · 4972 阅读 · 0 评论 -
Ubuntu搭建系统常用命令
版本 Ubuntu18.04项目搭建过程中用到的命令,自查用。切换用户的命令为:su username安装软件 :sudo apt install vimMysql:启动mysql:方式一:sudo /etc/init.d/mysql start方式二:sudo service mysql start停止mysql:方式一:sudo /etc/init.d/mysql stop方式二:sudo service mysql stop重启mysql:方式一:sudo/etc/init.d原创 2021-07-04 11:06:51 · 236 阅读 · 3 评论 -
命令行获取Django版本号
当前命令行执行python -m django --version原创 2021-07-03 19:41:38 · 168 阅读 · 0 评论 -
Django忘记admin管理密码
解决方法:项目目录下执行 python3 manage.py shell>>> from django.contrib.auth.models import User>>> user = User.objects.get(username='test')# 修改密码为 666666>>> user.set_password('666666')>>> user.save()...原创 2021-07-03 19:34:47 · 265 阅读 · 0 评论 -
Python3 基础知识总结
基础部分如运算、字符串格式化整理自 公众号:python那些事文章"""多行注释"""#author:xyHu #单行注释# 加减乘1 + 1 # => 28 - 1 # => 710 * 2 # => 20# 除法自动转换成浮点数35 / 5 # => 7.05 / 3 # => 1.66666666666666...原创 2019-01-10 10:20:15 · 298 阅读 · 0 评论 -
Python3实现汉诺塔问题
汉诺塔问题之前困扰了好久,这次看了一些视频和博客大概有了思路,简单理解就是把需要移动的盘子一层一层剥离,先把除了最后一个盘子移到中转杆b,最后只有一个盘子的时候将其直接移动到目的c杆上,然后向上回归将余下的盘子移动到c杆。def hanoi(n, a, b, c): if n==1: print(a, '-->', c) else: ha...原创 2019-01-03 13:48:55 · 475 阅读 · 0 评论 -
Python3 Configparser模块
转自https://www.cnblogs.com/yuanchenqi/articles/5732581.htmlConfigparser模块一般用于生成后缀名为 .ini 或 .cfg 的配置文件生成:import configparser config = configparser.ConfigParser()config["DEFAULT"] = {'ServerAl...转载 2019-01-11 13:30:23 · 923 阅读 · 4 评论 -
Python3 logging模块
本文转自https://www.cnblogs.com/yuanchenqi/articles/5732581.html,仅作留存,方便之后查找使用logging模块用于生成.log日志信息文件,供测试维护查阅一 (简单应用)import logging logging.debug('debug message') logging.info('info message') ...转载 2019-01-11 12:16:20 · 1329 阅读 · 0 评论 -
Python3 xml模块
删改、遍历操作:import xml.etree.ElementTree as ET tree = ET.parse("xmltest.xml")root = tree.getroot()print(root.tag) #遍历xml文档for child in root: print(child.tag, child.attrib) for i in child:...转载 2019-01-10 15:59:54 · 328 阅读 · 0 评论 -
Python3 os与sys模块
import osos.getcwd() # 获取当前工作目录,即当前python脚本工作的目录路径os.chdir("dirname") # 改变当前脚本工作目录;相当于shell下cdos.curdir # 返回当前目录: ('.')os.pardir # 获取当前目录的父目录字符串名:('..')os.makedirs('dirname1/dirname2') # 可...转载 2019-01-10 14:41:48 · 180 阅读 · 0 评论 -
Python3 数据结构
Python3数据结构:列表list、元组tuple、字典dict、集合set介绍及使用整理自公众号Python那些事文章=====================================列表===========================================================# 创建列表(list)li = []li2 = [4, 5, 6...原创 2019-01-10 13:15:14 · 359 阅读 · 0 评论 -
python中is判断比较地址
m = id(input())n = id(True)print(m,n)print(m is True)if(m): print('True')else: print('False')可知True值是有地址的 若用m is True的方式比较将返回False原创 2018-11-16 20:02:21 · 780 阅读 · 0 评论