我需要将网页转换为XML(使用Python 3.4.3).如果我将URL的内容写入文件,那么我可以完美地阅读和解析它,但如果我尝试直接从网页上读取,我的终端中会出现以下错误:
文件"./AnimeXML.py",第22行,在xml = ElementTree.parse(xmlData)文件"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/xml/etree/ElementTree.py" ,第1187行,在parse tree.parse(source,parser)文件"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/xml/etree/ElementTree.py",第587行,在解析源中= open(source,"rb")OSError:[Errno 36]文件名太长:
我的python代码:
# AnimeXML.py
#! /usr/bin/Python
# Import xml parser.
import xml.etree.ElementTree as ElementTree
# XML to parse.
sampleUrl = "http://cdn.animenewsnetwork.com/encyclopedia/api.xml?anime=16989"
# Read the xml as a file.
content = urlopen (sampleUrl)
# XML content is stored here to start working on it.
xmlData = content.readall().decode('utf-8')
# Close the file.
content.close()
# Start parsing XML.
xml = ElementTree.parse (xmlData)
# Get root of the XML file.
root = xml.getroot()
for info …Run Code Online (Sandbox Code Playgroud) 我有下一个代码
element.js
(function(){
/**
* Element builder
* @param {string} url
* @constructor
**/
element = function(url){
/**
* Web service url
* @type {string} Url service
* @private
*/
this._url = url;
};
/**
* Open web service
* @param {Object} param
**/
element.prototype.open = function(param){
};
})();
Run Code Online (Sandbox Code Playgroud)
我正在尝试测试js doc,并获取一些有关我的代码的文档。
我运行下一个命令
jsdoc --debug element.js
Run Code Online (Sandbox Code Playgroud)
我收到下一封邮件
DEBUG: JSDoc 3.3.2 (Sat, 13 Jun 2015 22:20:28 GMT)
DEBUG: Environment info: {"env":{"conf":{"tags":{"allowUnknownTags":true,"dictionaries":["jsdoc","closure"]},"templates":{"monospaceLinks":false,"cleverLinks":false,"default":{"outputSourceFiles":true}},"source":{"includePattern":".+\\.js(doc)?$","excludePattern":"(^|\\/|\\\\)_"},"plugins":[]},"opts":{"_":["element.js"],"debug":true,"destination":"./out/","encoding":"utf8"}}}
DEBUG: Parsing source files: ["/home/ismael-trabajo/Escritorio/js/element.js"]
Parsing /home/ismael-trabajo/Escritorio/js/element.js ...WARNING: The @type tag …Run Code Online (Sandbox Code Playgroud) 嗨,我正在尝试在我的 Debian 10 计算机上安装 docker,但在尝试安装 containerd.io 服务时遇到了一些问题。
当我尝试使用此命令进行安装时,出现错误,提示我需要升级依赖项。但是,如果我尝试手动升级,终端会向我显示我已经在使用此软件包的最新版本的建议。
sudo apt-get install docker-ce docker-ce-cli containerd.io
Run Code Online (Sandbox Code Playgroud)
我也尝试按照本教程进行操作,但它与我的 debian 版本不兼容
docker-ce : 取决于: libseccomp2 (>= 2.3.0) 但要安装 2.2.3-3ubuntu3
取决于:libseccomp2 (>= 2.4.0) 但要安装 2.3.3-4
我有一个复杂的XML需要解析.我知道如何解析一些重要的标签.
XML数据
<staff gid="2027930674">
<task>Director</task>
<person id="103045">Y?jir? Arai</person>
</staff>
Run Code Online (Sandbox Code Playgroud)
XML完整数据
<ann>
<anime id="16989" gid="1524403706" type="movie" name="Taif? no Noruda" precision="movie" generated-on="2015-04-27T08:05:39Z">
<info gid="1917137337" type="Picture" src="http://cdn.animenewsnetwork.com/thumbnails/fit200x200/encyc/A16989-1917137337.1429892764.jpg" width="141" height="200">
<img src="http://cdn.animenewsnetwork.com/thumbnails/hotlink-fit200x200/encyc/A16989-1917137337.1429892764.jpg" width="141" height="200"/>
<img src="http://cdn.animenewsnetwork.com/thumbnails/hotlink-max500x600/encyc/A16989-1917137337.1429892764.jpg" width="353" height="500"/>
</info>
<info gid="1994323462" type="Main title" lang="JA">Taif? no Noruda</info>
<info gid="1715491679" type="Alternative title" lang="JA">??????</info>
<info gid="898837990" type="Plot Summary">
On a certain isolated island, at a certain middle school, on the eve of the culture festival, Sh?ichi Azuma quits baseball after playing his whole life. He has a …Run Code Online (Sandbox Code Playgroud)