html = '''
Hello python
python
hello
'''
bs1 = BeautifulSoup(html, 'html.parser')
for bs_test in bs1.find('span').children:
print(bs_test)
输出:

为什么会有空行呢?
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
走同样的路,发现不同的人生