更新时间:2023-02-19 09:33:40
find_all
方法返回一个列表.遍历列表以获取文本.
The find_all
method returns a list. Iterate over the list to get the text.
for name in names:
print(name.text)
返回:
Baden-Württemberg
Bayern
Berlin
内置的python dir()
和 type()
方法总是很方便地检查对象.
The builtin python dir()
and type()
methods are always handy to inspect an object.
print(dir(names))
[...,
'__sizeof__',
'__str__',
'__subclasshook__',
'__weakref__',
'append',
'clear',
'copy',
'count',
'extend',
'index',
'insert',
'pop',
'remove',
'reverse',
'sort',
'source']