![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
xiaoguuca
新鲜水果,原产地发货。淘宝店名:水果鲜的吗
展开
-
Python语言设计 下
程序的三种控制结构顺序结构、分支结构、循环结构顺序结构>>> b='hello world'>>> b'hello world'分支结构if '9' in ('1','2','3') or 9<8: print('ddd')print('*'*20)>>> if '9' in ('1','2','3'...原创 2019-11-24 12:15:22 · 145 阅读 · 0 评论 -
Python语言设计 上
python提供了3种数字类型:整数类型(整数)、浮点数类型(实数)、复数类型(复数)整数>>> bin(0)'0b0'``>>> bin(1)'0b1'>>> bin(2)'0b10'>>> bin(3)'0b11'>>> bin(4)'0b100'>>> bi...原创 2019-11-19 20:56:25 · 219 阅读 · 0 评论 -
参数,*args和*kwargs,*和**的区别
*args和**kwargs*args的使用方法*args 用来将参数打包成tuple给函数体调用def n(*args): print(args,type(args))n() # () <class 'tuple'>n('lps')# ('lps',) <class 'tuple'>n(12212)# (12212,) <class ...转载 2019-05-09 22:58:55 · 121 阅读 · 0 评论 -
创建好github后编辑个人博客
转载https://blog.csdn.net/fxjzzyo/article/details/78079075转载 2019-05-09 09:59:09 · 300 阅读 · 0 评论 -
装饰器,变量在内存的存储与地址变化
函数“变量”(或“变量”函数)x = 1y = xdef test1(): print("Do something")test2 = lambda x:x*2函数和变量是一样的,都是“一个名字对应内存地址中的一些内容”那么根据这样的原则,我们就可以理解两个事情:1.test1表示的是函数的内存地址2.test1()就是调用对在test1这个地址的内容,即函数高阶函数...转载 2019-05-08 16:27:58 · 288 阅读 · 0 评论 -
变量;引用
局部变量,全局变量局部变量: 局部变量是在函数内部定义的变量,只能在函数内部使用,临时保存函数内部需要使用的数据 函数执行结束后,函数内部的局部变量,会被系统回收 不同的函数,可以定义相同的名字的局部变量,但是各用各的不会产生影响 全局变量: 全局变量是在函数外部定义的变量,(没有定义在某一个函数内),所有函数内部都可以使用这个变量局部变量def n(): #定义一...转载 2019-05-05 18:01:34 · 147 阅读 · 0 评论 -
while函数
定义函数def n (): num1=1 num2=5 result=num1+num2 print('%d+%d=%d'%(num1,num2,result))#调用函数n()#num1,num2为形参def n(num1,num2): result=num1+num2 print('%d+%d=%d'%(num1,num2,resul...转载 2019-05-05 15:52:37 · 4888 阅读 · 0 评论 -
Git基本操作命令
转载至:http://www.cnblogs.com/wj-1314/p/7992543.html转载 2019-05-03 14:50:57 · 73 阅读 · 0 评论 -
print函数
实现对象以字符串表示的方式格式化输出到流文件对象file里。其中所有非关键字参数都按str()方式进行转换为字符串输出,关键字参数sep是实现分隔符,比如多个参数输出时想要输出中间的分隔字符;关键字参数end是输出结束时的字符,默认是换行符\n;关键字参数file是定义流输出的文件,可以是标准的系统输出sys.stdout,也可以重定义为别的文件;参数flush是立即把内容输出到流文件,不作缓存...转载 2019-04-27 20:26:54 · 75 阅读 · 0 评论 -
urllib库
Httpresponse是由Django创造的,在django.http模块中定义了HttpResponse对象的API定义编码import jsonresult = response.read()result.decode('utf-8')jsonData = json.loads(result) 可以简写成response.read().decode('utf-8')respo...原创 2019-04-27 13:51:46 · 86 阅读 · 0 评论 -
python面向对象
1、类的用法在类中的函数的第一个参数一定是selfclass person: def info(self,name,age): print('you name is %s,and you are %s year old%(name,age)')原创 2019-03-26 21:00:37 · 73 阅读 · 0 评论 -
修改数据库等待时间
输入show global variables like ‘%timeout’;来找到并查看等待时间;mysql> show global variables like '%timeout';+-----------------------------------+----------+| Variable_name | Value |+...原创 2019-02-10 16:44:53 · 753 阅读 · 0 评论 -
django框架安裝
创建虚拟环境: mkvirtualenv env2 ,env2为虚拟环境名称安装框架: pip install django == 1.8.2path下环境变量配置:C:\Users\dell\Envs\env2\Lib\site-packages\djangoDjango主要使用django-admin.py这个脚本来管理项目,默认情况下,Django是安装到Python的安装目录之内...原创 2018-12-09 13:13:26 · 135 阅读 · 0 评论 -
python中Object of type bytes is not JSON serializable
源码:爬虫文件中,管道文件中item['positionName'] = node.xpath("./td[1]/a/text()").extract()[0].encode("utf-8")self.f.write(content)此时运行报错TypeError: Object of type bytes is not JSON serializable类型字节的对象不是JSON...原创 2018-12-03 11:41:23 · 4699 阅读 · 0 评论 -
打印出的json文件为空
运行代码时报错Traceback (most recent call last): File "C:\Users\dell\AppData\Local\Programs\Python\Python37\lib\site-packages\twisted\internet\defer.py", line 654, in _runCallbacks current.result = c...原创 2018-11-30 21:05:46 · 840 阅读 · 0 评论 -
module 'code' has no attribute 'InteractiveInterpreter'
File "C:\Users\dell\AppData\Local\Programs\Python\Python37\lib\site-packages\twisted\conch\manhole.py", line 55, in <module> class ManholeInterpreter(code.InteractiveInterpreter):#class M...原创 2018-11-29 22:27:36 · 2161 阅读 · 0 评论 -
使用dict.key
单独使用dict.keys() 时,出现错误。>>> dict = {"name": "jack",... "age": 15,... "height":1.75}>>> for k in dict.key():... print(k)...Traceback (most recent c原创 2018-11-25 10:04:21 · 1561 阅读 · 0 评论 -
python 3.7 安装 Twisted 错误与解决
python 3.7 安装 Twisted 错误与解决当我pip install twisted单独安装Twisted过程中发现Twisted报错。Requirement ‘Twisted-18.9.0-cp27-cp27m-win_amd64.whl’ looks like a filename, but the file does not existTwisted-18.9.0-cp27...原创 2018-11-20 14:03:02 · 10989 阅读 · 5 评论 -
python输入
我在网上搜索资料时,输入代码一直没有按照格式&gt;&gt;&gt; str1='i love python'#定义了一个字符串,在此例子中,可以改成列表、元组。&gt;&gt;&gt; for k in str1:#这是一个循环,先从str1中取i,执行print;接着‘空格’,执行print…… print(k,end=',')#逐次打印k,用end是横着打印 ...原创 2018-11-24 18:52:23 · 458 阅读 · 0 评论