[Python] BeautifulSoup tags > </a>

using BeautifulSoup
how can i get the txt between all the

> </a>

example

>The Student [2017].mp4</a>

thanks

Are you using BeautifulSoup 3 or BeautifulSoup 4?

Beautiful Soup Documentation � Beautiful Soup 4.4.0 documentation

This should work, according to the docs (untested):

from bs4 import BeautifulSoup
markup = '<a href="https://unix.com/">The Student [2017].mp4</a>'
soup = BeautifulSoup(markup)

tag = soup.a
tag.string
# The Student [2017].mp4

Tweak as you see fit .....

Ref:

Beautiful Soup Documentation � Beautiful Soup 4.4.0 documentation

hi thanks for reply

your code did not work

need to get all the txt between all of the > </a>

Works fine for me:

linux:/tmp# python p.py
The Student [2017].mp4
linux:/tmp# cat p.py
from bs4 import BeautifulSoup
markup = '<a href="https://unix.com/">The Student [2017].mp4</a>'
soup = BeautifulSoup(markup, 'lxml')

tag = soup.a
print tag.string
# The Student [2017].mp4

My goal was to show the way to do it; but you can do things like add print statements in python for yourself :slight_smile:

so your saying that will get me all

the txt between all of the > </a>

on the page not just one

as there are about 200 of them all with different txt between them

I am saying you have not written or posted a single line of code here; nor have you posted a single error message.

Are you expecting us to write your entire code for you?

Read the docs for you? Do all your work for you?

If so, you have come to the wrong place, sorry.

We are here to help you write your own code.

So far, I have written more code than you on this.... LOL .

You have not provided us a single line of YOUR OWN python code.

ok lol i explain more

on the page i am trying to scrape are about 200 of these > </a>
inbetween all of them are different txt
i want all the txt from all of them not just one

your code give me just one

Yes, and it is not our job to write you code for you.

Do you understand that?

Yes? No?

Where is YOUR CODE?

PS: I see what is "going on here" ... you want us to write your code for you.

Isn't that right?

i want help with code not for you to write it all

in post one you see i ask for help

to get txt betweeen all > </a>

your code works for just one

Thread closed.

Original poster refused to write a single line of python code or read any documentation related to a simple python script.