小编arm*_*884的帖子

在html/xhtml中解析RDFa?

在perl中使用RDF :: RDFa :: Parser模块来解析网站外的rdf数据.在带有!DOCTYPE HTML PUBLIC的网站上" - // W3C // DTD HTML 4.01 Transitional // EN">它可以工作,但在使用xhtml的网站上!DOCTYPE html PUBLIC" - // W3C // DTD XHTML 1.0 Transitional // EN "" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">没有输出......

测试网站 - > http://www.filmstarts.de/kritiken/186918.html

use RDF::RDFa::Parser;

my $url     = 'http://www.filmstarts.de/kritiken/186918.html';
my $options = RDF::RDFa::Parser::Config->tagsoup;
my $rdfa    = RDF::RDFa::Parser->new_from_url($url, $options);

print $rdfa->opengraph('image');
print $rdfa->opengraph('description');
Run Code Online (Sandbox Code Playgroud)

html xml perl parsing rdfa

2
推荐指数
1
解决办法
212
查看次数

Python MemoryError

我有一个小脚本,从python中的给定字符生成一个单词列表.但是在执行后总会得到一个MemoryError.为什么它存储在ram中?是否有更好的代码方法不使用ram但提供工作输出?

from itertools import product
chars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k', 
         'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 
         'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 
         'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 
         'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', 
         '4', '5', '6', '7', '8', '9']
length = 8
result = ["".join(item) for item in product(*[chars]*length)]
for item in result:
    print(item)
Run Code Online (Sandbox Code Playgroud)

python python-itertools python-3.x

1
推荐指数
1
解决办法
9796
查看次数

标签 统计

html ×1

parsing ×1

perl ×1

python ×1

python-3.x ×1

python-itertools ×1

rdfa ×1

xml ×1