Python Forum
Parsing link from html tags with Python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Parsing link from html tags with Python
#1
Hello. I need to copy the link from canonical html tag to the other tags below. I have many html files with these lines, so I must change in all the folder.

<link rel="canonical" href="https://website.com/en/dono.html" />

and

    <div class="somers"><a href="https://website/amadonperrish.html" class="flags bg" hreflang="bg" title="bk"></a>
    <a href="https://website.com/test-lofet.html" class="flags sk" hreflang="sk" title="sk"></a>
    <a href="https://website.com/mercy.html" class="flags uk" hreflang="uk" title="uk"></a>
The output should be

    <div class="somers"><a href="https://website.com/en/dono.html" class="flags bg" hreflang="bg" title="bk"></a>
    <a href="https://website.com/en/dono.html" class="flags sk" hreflang="sk" title="sk"></a>
    <a href="https://website.com/en/dono.html" class="flags uk" hreflang="uk" title="uk"></a>
Does anyone know a solution in Python for this problem?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  why doesn't it replace all html tags? Melcu54 3 739 Jul-05-2023, 04:47 AM
Last Post: Melcu54
  Tkinterweb (Browser Module) Appending/Adding Additional HTML to a HTML Table Row AaronCatolico1 0 923 Dec-25-2022, 06:28 PM
Last Post: AaronCatolico1
  BeautifulSoup - I can't translate html tags that contain <a href=..</a> OR <em></em> Melcu54 10 1,628 Oct-27-2022, 08:58 AM
Last Post: wavic
  How do I link the virtual environment of that project to the 3.9.2 version of python? Bryant11 1 1,367 Feb-26-2022, 11:15 AM
Last Post: Larz60+
  I can't open a link with Selenium in Python jao 0 1,392 Jan-30-2022, 04:21 AM
Last Post: jao
  Get text from within h3 html tags Pedroski55 8 4,276 Jan-05-2022, 06:50 AM
Last Post: Larz60+
  reading html and edit chekcbox to html jacklee26 5 3,070 Jul-01-2021, 10:31 AM
Last Post: snippsat
  Delimiters - How to skip some html tags from being translate Melcu54 0 1,647 May-26-2021, 06:21 AM
Last Post: Melcu54
  How to link Sublime Text 3 Build system to Python 3.9 Using Windows 10 Fanman001 2 4,593 Mar-04-2021, 03:09 PM
Last Post: martpogs
  Is there a better way? Python parsing tlewick1 1 1,750 Oct-17-2020, 05:48 PM
Last Post: bowlofred

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020