You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pxr3c4n65/step1.py

31 lines
531 B

4 years ago
# -*- coding: utf-8 -*-
4 years ago
# added by daiao
4 years ago
from pyquery import PyQuery as pq
f = open("step1/index.html", encoding='utf-8')
# f = open("../step1/result.html", encoding='utf-8')
html = f.read()
f.close()
doc = pq(html)
tag = input()
result = ''
if tag == 'h1' or 'p':
result = doc(tag).text()
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),
4 years ago
print (result, end='')