'How to select one while parsing (bs4, python)

I am trying to parse data, but get so strange error. I se that varuable "a" has type bs4.element.Tag and contains some data. However when I try to aplly any function (I am trying to use strip()) I get an error

TypeError: 'NoneType' object is not callable

Why do I get it if I see that a contains data?

My code:

import pandas as pd
import requests
import bs4

session = requests.Session()
session.headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36',
                                'Accept-Language': 'ru'}

url = 'https://tvoe.ru//catalog/jenshchinam/odejda/yubka/973977/?oid=973978'


res = session.get(url=url)
res.raise_for_status()
text = res.text

soup = bs4.BeautifulSoup(text, 'lxml')
container = soup.select(
    'div.container_inner.clearfix ')

a = (container[0].select_one('a.pc-category-block__title'))

What I see if try to look at a <a class="pc-category-block__title" href="/catalog/jenshchinam/odejda/yubka/">Юбки</a>.

I want to get Юбки by using a.strip('>'). But always get TypeError: 'NoneType' object is not callable



Solution 1:[1]

You might use .text attribute if you need to access text visible to user from tag, that is

a = (container[0].select_one('a.pc-category-block__title'))
textintag = a.text
print(textintag)

output

????

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Daweo