Trying to convert three lines of python to Go - XPATH

polaris · · 454 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hello,</p> <p>I wrote a program a while back in python and I am converting it over to Go. However, I am having trouble with three lines of code. Can someone please help me out? Thank you!!! </p> <p>Here is the python code:</p> <p><a href="http://pastebin.com/YgaX8Cxc" rel="nofollow">http://pastebin.com/YgaX8Cxc</a></p> <p>Here is what I have in Go:</p> <p><a href="http://pastebin.com/31NsJUBY" rel="nofollow">http://pastebin.com/31NsJUBY</a></p> <hr/>**评论:**<br/><br/>professorGroblin: <pre><p>I&#39;d recommend looking at <a href="https://github.com/PuerkitoBio/goquery" rel="nofollow">goquery</a> or something similar when dealing with HTML. There are XPATH tools out there, but don&#39;t conflate html with xml/xhtml.</p></pre>shovelpost: <pre><p>Also take a look at xmlpath <a href="https://godoc.org/gopkg.in/xmlpath.v1" rel="nofollow">v1</a> or <a href="https://godoc.org/gopkg.in/xmlpath.v2" rel="nofollow">v2</a>. I&#39;ve used it a while ago to do some stuff I sadly couldn&#39;t do with the standard library. It&#39;s well-written.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

454 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传