Compare commits
3 Commits
Author | SHA1 | Date |
---|---|---|
planet | 807b2d3860 | 4 years ago |
planet | 7e4f869189 | 4 years ago |
planet | a0e8c910eb | 4 years ago |
@ -1,30 +1,35 @@
|
||||
# add ...
|
||||
# -*- coding: utf-8 -*-
|
||||
# author: youxinyu
|
||||
# githb: yogayu
|
||||
|
||||
# added by daiao
|
||||
|
||||
from pyquery import PyQuery as pq
|
||||
|
||||
f = open("step1/index.html", encoding='utf-8')
|
||||
# f = open("../step1/result.html", encoding='utf-8')
|
||||
|
||||
f = open("step2/index.html", encoding='utf-8')
|
||||
html = f.read()
|
||||
f.close()
|
||||
|
||||
doc = pq(html)
|
||||
|
||||
tag = input()
|
||||
|
||||
result = ''
|
||||
if tag == 'h1' or 'p':
|
||||
result = ""
|
||||
if tag == "meta":
|
||||
tag = doc('meta:nth-child(4)')
|
||||
attr = input()
|
||||
result = tag.attr(attr)
|
||||
else:
|
||||
tag = doc(tag)
|
||||
result = doc(tag).text()
|
||||
print (result, end='')
|
||||
|
||||
|
||||
if tag == 'align':
|
||||
h1Align= doc('h1').attr('align')
|
||||
pAlign= doc('p').attr('align')
|
||||
result = (h1Align and pAlign)
|
||||
|
||||
if tag == 'bgcolor':
|
||||
result = doc('body').attr('bgcolor')
|
||||
|
||||
# print(result),
|
||||
print (result, end='')
|
||||
|
||||
|
Loading…
Reference in new issue