从字符串中剪切特定部分,删除HTML标签。 [网页抓取]

时间:2020-03-18 11:38:45

标签: python web-scraping beautifulsoup

我得到如下结果:

getKeyOf(columns: string[]): (keyof MyClass)[] {
...
}

我只想提取一个变量ex的链接。链接,以及另一个ex的名称。名称。 到目前为止,这是我的代码。

/* try to connect */
$inbox = imap_open($hostname,$username ,$password) or die('Cannot connect to Gmail: ' . imap_last_error());

/* grab emails */
$emails = imap_search($inbox,'ALL');

/* if emails are returned, cycle through each... */
if($emails) {

    /* begin output var */
    $output = '';

    /* put the newest emails on top */
    rsort($emails);

    /* for every email... */
    foreach($emails as $email_number) {

        /* get information specific to this email */
        $overview = imap_fetch_overview($inbox,$email_number,0);


        $output.= 'Name:  '.$overview[0]->from.'</br>';
            $output.= 'Email:  '.$overview[0]->message_id.'</br>';



    }

    echo $output;
} 

/* close the connection */
imap_close($inbox);

1 个答案:

答案 0 :(得分:0)

您只需在查找末尾添加 ['href']

for icon in the_icons:
    name = icon.find('a', class_='ellipsis')['href']