你没见过的python语法 1、不一样的列表 输出: 2、改变type中的规则,创建类:类属性大写 输出: 3、%s字串格式化,不用元组用字典 输出: 4、没有参数抛出异常 输出: ...
分类:
编程语言 时间:
2018-09-28 01:39:05
阅读次数:
186
Python代码如下:输入经纬度和编码级别计算对应的geohash编码frommathimportlog10__base32=‘0123456789bcdefghjkmnpqrstuvwxyz‘__decodemap={}foriinrange(len(__base32)):__decodemap[__base32[i]]=idelidefdecode_exactly(geohash):lat_i
分类:
其他好文 时间:
2018-09-27 18:10:26
阅读次数:
146
一、命名关键字参数 对于关键字参数,函数的调用者可以传入任意不受限制的关键字参数 。至于到底传入了哪些,就需要在函数内部通过kw检查。 仍以person()函数为例,我们希望检查是否有city和job参数: def person(name, age, **kw): if 'city' in kw: ...
分类:
其他好文 时间:
2018-09-26 20:50:20
阅读次数:
228
首先用pipenv安装xadmin pipenv install xadmin 下载成功之后会报错 Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", l ...
分类:
其他好文 时间:
2018-09-24 13:42:06
阅读次数:
258
使用traceback获取详细的异常信息 只知道是报了这个错,但是却不知道在哪个文件哪个函数哪一行报的错。 下面使用traceback模块 import traceback try: 1/0 except Exception,e: traceback.print_exc()结果: 输出结果是 Tra ...
分类:
其他好文 时间:
2018-09-19 19:58:40
阅读次数:
147
twistederror在windows中使用pip安装twisted的时候出现error如下:pystate.h文件exc_typeexc_valueexc_traceback不是_ts的成员。打开pystate.h文件,找到_ts的结构体typedefstruct_ts添加如下代码:_PyErr_StackItemexc_type;_PyErr_StackItemexc_value;_PyEr
服务端selectserver.py 客户端selectclient.py 在客户端断开时 Traceback (most recent call last): File "selectserver.py", line 21, in data = fb.recv(4096) ConnectionRe ...
分类:
其他好文 时间:
2018-09-16 21:33:11
阅读次数:
947
classC:def__getattr__(self,name):print(1)returnsuper().__getattr__(name)def__getattribute__(self,name):print(2)returnsuper().__getattribute__(name)def__setattr__(self,name,value):print(3)super().__set
分类:
其他好文 时间:
2018-09-15 17:32:55
阅读次数:
184
读取保存有多个样例的TFRecord文件时报错: 从报错信息来看,与reshape有关。 先生成保存有两张图片的TFRecord文件 错误读取: 正确读取: InvalidArgumentError (see above for traceback): Input to reshape is a t ...
分类:
其他好文 时间:
2018-09-11 21:19:49
阅读次数:
1088
问题: >>> import MySQLdb Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/anaconda3/envs/LearnDjango/lib/python2.7/site-pac ...
分类:
数据库 时间:
2018-09-07 23:16:23
阅读次数:
667