Sparta Coding W3: Python

한소영
Jun 26, 2021

--

I learn basic Python coding and Web Crawling. This week’s HW is using requests, BeautifulSoup to select (rank, title, author) of song list in genie website.

I started this using a part of codes in hello.py (requests, BaeautifulSoup) and changed URL. I just need to print the (rank, title, and artist). For each dataset, it printed rank, rank-up…, and extra lines.

After googling, I try

text[0:2].strip()

Still contains several lines of space

rank = a_rank.strip()

title=a_title.text.strip()

artist=a_artist.text.strip()

This fixed the problem.

--

--

한소영
한소영

Written by 한소영

0 Followers

Physicist, Educator, Director of Maker Innovation, USM