The behavior you're seeing is by design.
"Although string is for finding strings, you can combine it with arguments that find tags: Beautiful Soup will find all tags whose .string matches your value for string."
https://www.crummy.com/software/BeautifulSoup/bs4/doc/#the-string-argument
So you're searching for a tag with a special .string. How does .string work?
https://www.crummy.com/software/BeautifulSoup/bs4/doc/#string
"If a tag’s only child is another tag, and that tag has a .string, then the parent tag is considered to have the same .string as its child."
"If a tag contains more than one thing, then it’s not clear what .string should refer to, so .string is defined to be None."
The first <a> tag contains more than one thing ("Juggernaut" and a <span> tag that contains "Store"), so its .string is defined to be None.
The second <a> tag contains one thing, a <span> tag, which contains one thing, "menu", so its .string is defined to be "menu".
The behavior you're seeing is by design.
"Although string is for finding strings, you can combine it with arguments that find tags: Beautiful Soup will find all tags whose .string matches your value for string."
https:/ /www.crummy. com/software/ BeautifulSoup/ bs4/doc/ #the-string- argument
So you're searching for a tag with a special .string. How does .string work?
https:/ /www.crummy. com/software/ BeautifulSoup/ bs4/doc/ #string
"If a tag’s only child is another tag, and that tag has a .string, then the parent tag is considered to have the same .string as its child."
"If a tag contains more than one thing, then it’s not clear what .string should refer to, so .string is defined to be None."
The first <a> tag contains more than one thing ("Juggernaut" and a <span> tag that contains "Store"), so its .string is defined to be None.
The second <a> tag contains one thing, a <span> tag, which contains one thing, "menu", so its .string is defined to be "menu".