草庐IT

points_into_buffer

全部标签

python - 为什么我安装的应用程序处理 pkg_resources.iter_entry_points 的方式与源代码不同?

我有一个Python应用程序,它通过pkg_resources.iter_entry_points寻找插件。当直接从源checkout运行时,这将在sys.path中找到符合要求的任何内容,包括碰巧具有适用的.egg-info的源checkout为setuptools找到。然而,当我通过pythonsetup.pyinstall在任何地方安装包时,它突然停止检测sys.path中枚举的所有内容,而只查找已安装的内容在site-packages中与它一起。为什么pkg_resources.iter_entry_points对于vanilla源checkout和安装的应用程序表现不同?如何

python - IbPy : How to extract API response into a variable

我正在研究IbPy是否可以成为我连接到InteractiveBrokers交易API的好方法。作为测试,我现在正在尝试收集一些股票价格快照,看看我是否能让IbPy为我工作。我正在使用Brokertron网关连接IB。我从IBAPI得到了请求的股票价格(来self发现的一些带有错误处理的示例代码,见下文),所以从技术上讲它适用于IBAPI,但我无法弄清楚如何将特定字段(下图field=4,price=175.95)提取到变量中供以后使用。关于如何将字段4内容放入变量的任何想法?谢谢!Python示例脚本:importibfromib.ext.ContractimportContractf

python - 类型错误 : expected a character buffer object

我正在尝试将列表的列表写入新文件,但出现此错误:Traceback(mostrecentcalllast):File"",line1,indowork()File"C:\Python27\work\accounting\formattingquickbooksfile\sdf.py",line11,indoworkWriteFile()File"C:\Python27\work\accounting\formattingquickbooksfile\sdf.py",line71,inWriteFilef.write(thefile)TypeError:expectedacharacte

python - 类型错误 : Type str doesn't support the buffer API when splitting string

大家好,我有这段代码:data=data.split('&')我收到以下错误:data=data.split('&')TypeError:Typestrdoesn'tsupportthebufferAPI如何拆分我的字符串? 最佳答案 data是一个bytes对象。你只能使用另一个bytes值来拆分它,你可以使用bytes文字(以b前缀开头)来创建一个:data.split(b'&') 关于python-类型错误:Typestrdoesn'tsupportthebufferAPIwhen

python - 如何在 Windows 上使用 Python 的 Protocol Buffer ?

我一直在尝试在我的Python程序中使用ProtocolBuffer,但无法让它工作。我正在运行Windows8机器并尝试过Python2.7.6和Python3.3。我下载了适用于Python的二进制ProtocolBuffer编译器,并使用它从我的myProto.proto文件生成了myProto_pb2.py,但是当我运行Python时出现以下错误程序:在“importmyProto_pb2”行中,使用2.5版ProtocolBuffer中的Python2.7.6时出现以下错误:fromgoogle.protobufimportdescriptoras_descriptorImp

python - 检查点是否在椭圆内比 contains_point 方法更快

我使用matplotlib1.15.1并尝试生成这样的散点图:椭圆的大小是固定的,用中心坐标、宽度、高度和角度(从外部提供)绘制:我不知道它们的方程式是什么。g_ell_center=(0.8882,0.8882)g_ell_width=0.36401857095483g_ell_height=0.16928136341606g_ellipse=patches.Ellipse(g_ell_center,g_ell_width,g_ell_height,angle=angle,fill=False,edgecolor='green',linewidth=2)这个省略号应该在我的图上标记正

Python3 CSV writerows,TypeError : 'str' does not support the buffer interface

我正在将以下Kaggle代码翻译成Python3.4:在输出CSV文件时的最后几行,predictions_file=open("myfirstforest.csv","wb")open_file_object=csv.writer(predictions_file)open_file_object.writerow(["PassengerId","Survived"])open_file_object.writerows(zip(ids,output))predictions_file.close()print('Done.')有一个类型错误TypeError:'str'doesno

python - 找到 TypeError : coercing to Unicode: need string or buffer, 列表

我正在尝试启动并运行数据解析脚本。就数据操作而言,它是有效的。我想做的是设置它,这样我就可以用一个命令输入多个用户定义的CSV。例如>pythonscript.pyOne.csvTwo.csvThree.csv如果您对如何自动命名输出CSV有任何建议,那么如果input=test.csv,output=test1.csv,我会也很感激。获取TypeError:coercingtoUnicode:needstringorbuffer,listfound为线forlineincsv.reader(open(args.infile)):我的代码:importcsvimportpprintpp

python - 类型错误 : Type str doesn't support the buffer API # find method?

这是我的输入:..........JimCramer‏@jimcramer26NovLovethisspirited&rigorous$TSLAdefense!RT@InfennonLabs:Whyaretheseidiotsselling#tslaaretheythatblind?@jimcramerFavorited5times...........例如这个“输入”在我的input变量中。这是我的代码:start_link=input.find('如果我运行它,我会得到以下错误:start_link=input.find('我该如何解决这个问题?注意:我的输入变量的类型是:

python 和 Pandas : Combine columns into a date

在我的dataframe中,时间分为3列:year、month、day,例如这个:如何将它们转换成日期,以便进行时间序列分析?我能做到:df.apply(lambdax:'%s%s%s'%(x['year'],x['month'],x['day']),axis=1)给出:10951954111096195412109719541310981954141099195415110019541611011954171102195418110319541911041954110110519541111106195411211071954113但是接下来呢?编辑:这就是我最终得到的:fromda