草庐IT

display-name

全部标签

python 正则表达式 : duplicate names in named groups

有没有办法在python的正则表达式命名组中使用相同的名称?例如(?Pfoo)|(?Pbar).用例:我正在trycatchtype和id使用此正则表达式:/(?=videos)((?Pvideos)/(?P\d+))|(?P\w+)/?(?Pv)?/?(?P\d+)?来自这个字符串:/channel/v/123/ch/v/41500082/channel/视频/41500082现在我收到错误:redefinitionofgroupname'id'asgroup6;wasgroup3 最佳答案 答案是:Pythonre不支持同名组。

python - ImportError : No module named catkin_pkg. 包

我正在尝试运行:-roslaunchturtlebot_gazeboturtlebot_world.launch但是我得到以下错误Traceback(mostrecentcalllast):File"/opt/ros/kinetic/share/xacro/xacro.py",line55,inimportxacroFile"/opt/ros/kinetic/lib/python2.7/dist-packages/xacro/__init__.py",line42,infromroslaunchimportsubstitution_argsFile"/opt/ros/kinetic/l

Python hadoop 流式传输 : Setting a job name

我有一个使用hadoop-streaming在我的集群上运行的作业我必须开始一个新工作,我想为其添加工作名称,我如何通过命令行或文件传递该选项来设置工作名称?在Java中,你可以这样说JobConfconf=newJobConf(WordCount.class);conf.setJobName("wordcount");如何使用hadoop-streaming做到这一点? 最佳答案 使用-Dkey=value表示法配置属性:-Dmapred.job.name='MyJob'您可以通过仅使用-info参数调用流jar来列出一大堆选项

python - GDB pretty-print ImportError : No module named 'printers'

我正在尝试添加prettyprinting对于Ubuntu14.04上我的GDB中的STL。有关工具的一些详细信息:操作系统:Ubuntu14.04gdb版本:7.7python版本:2.7.6python3版本:3.4.0但是在我完全按照说明进行设置之后。我仍然收到以下错误:Traceback(mostrecentcalllast):File"",line3,inFile"/home/jerry/myLib/gdb_stl_support/python/libstdcxx/v6/__init__.py",line19,infromprintersimportregister_libs

python - ImportError : cannot import name simplejson. 我正在使用 django v1.8 和 django-Select2 v4.3.1

我的错误(命令pythonmanage.pyrunserver)-文件“/Users/username/virtual-env/lib/python2.7/site-packages/jsonfield/fields.py”,第3行,在从django.utils将simplejson导入为jsonImportError:无法导入名称simplejson我尝试了这两个帖子中的解决方案,但它们在我的案例中不起作用Cannotimportnamesimplejson-AfterinstallingsimplejsonHowtosolvetheImportError:cannotimportn

python - 如何修复错误 Xlib.error.DisplayConnectionError : Can't connect to display ":0": b'No protocol specified\n'

我正在用python3和XLib制作一些程序。在装有Ubuntu14.04的PC上,一切正常,但是当我尝试在手动安装Xorg的笔记本电脑上运行我的应用程序时,出现异常:Xlib.error.DisplayConnectionError:Can'tconnecttodisplay":0":b'Noprotocolspecified\n'在线:self.__display=Xlib.display.Display()这是怎么回事?如何解决这个问题,使其可以在每个Linux上运行?编辑:这看起来不像是X11:runagnomeappasanotheruser的副本.在我的两台计算机上,我有相

python - Seaborn 因子图 : set series order of display in legend

Seaborn,对于某些特殊情况,对图例的排序有时与绘图顺序不同:data={'group':[-2,-1,0]*5,'x':range(5)*3,'y':range(15)}df=pd.DataFrame(data)sns.factorplot(kind='point',x='x',y='y',hue='group',data=df)虽然绘图序列是[-2,-1,0],但图例按[-1,-2,0]的顺序列出。我目前的解决方法是禁用factorplot中的图例,然后使用matplotlib添加图例。有没有更好的办法? 最佳答案 我想你要

python - pylab导入错误: No module named _thread

从ubuntu10.04开始,我使用easy_install安装了pylab。升级后,我可以导入pylab。首先,我运行从easy_install安装的ipython:$ipythonPython2.6.5(r265:79063,Apr162010,13:09:56)Type"copyright","credits"or"license"formoreinformation.IPython0.11--AnenhancedInteractivePython.?->IntroductionandoverviewofIPython'sfeatures.%quickref->Quickrefe

python - 名称错误 : name 'UTC' is not defined

datetime.datetime.now()的输出在我的本地UTC-8时区输出。我想将其转换为具有UTCtzinfo的适当时间戳。fromdatetimeimportdatetime,tzinfox=datetime.now()x=x.replace(tzinfo=UTC)^输出NameError:name'UTC'isnotdefinedx.replace(tzinfo=)输出SyntaxError:invalidsyntaxx.replace(tzinfo='UTC')输出TypeError:tzinfo参数必须是None或属于tzinfo子类,而不是类型'str'完成示例的正确

Python MySQLdb : Query parameters as a named dictionary

关闭。这个问题需要debuggingdetails.它目前不接受答案。编辑问题以包含desiredbehavior,aspecificproblemorerror,andtheshortestcodenecessarytoreproducetheproblem.这将有助于其他人回答问题。关闭3年前。Improvethisquestion我想将查询参数作为命名字典传递给MySQLdb的cursor.execute()方法,以便它们从转义SQL注入(inject)。你能解释一下为什么会出现KeyError吗:>>>c.execute('selectidfromuserswhereusern