File tree Expand file tree Collapse file tree 3 files changed +14
-0
lines changed
2020-06-29-neteasy-cloudmusic-songlist-export Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change 1+ from bs4 import BeautifulSoup
2+
3+
4+ # 文件 test.html 需由读者自行创建
5+ with open ("test.html" , "r" , encoding = "utf-8" ) as f :
6+ content = f .read ()
7+
8+ response = BeautifulSoup (content ,'lxml' )
9+
10+ results = response .find_all ("b" )
11+
12+ with open ("SongList.txt" , "w+" , encoding = "utf-8" ) as f :
13+ f .writelines ([result ["title" ] + "\n " for result in results ])
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ Python技术 公众号文章代码库
44
55- [ 2020-02-29-python-spiro] ( https://github.com/JustDoPython/python-examples/tree/master/xuanyuanyulong/2020-02-29-python-spiro )
66- [ 2020-03-27-PDF-watermark] ( https://github.com/JustDoPython/python-examples/tree/master/xuanyuanyulong/2020-03-27-PDF-watermark )
7+ - [ 2020-06-29-neteasy-cloudmusic-songlist-export] ( https://github.com/JustDoPython/python-examples/tree/master/xuanyuanyulong/2020-06-29-neteasy-cloudmusic-songlist-export )
78
89
910关注公众号:python 技术,回复"python"一起学习交流
You can’t perform that action at this time.
0 commit comments