From a0e8c910eb034dbd8ec4a88e85af11da24409dde Mon Sep 17 00:00:00 2001 From: planet <985981442@qq.com> Date: Wed, 22 Jul 2020 09:20:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9step1=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- step1.py | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/step1.py b/step1.py index b913c17..0102212 100644 --- a/step1.py +++ b/step1.py @@ -1,28 +1,22 @@ # -*- coding: utf-8 -*- +# author: youxinyu +# githb: yogayu 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='') \ No newline at end of file