Message from Python discussions

November 2018

— I'd do something like this: open two files, the one containing your text an a new file. Read lines on your files. As you read them append them to a variable (or directly write the line to the other file). Also, store the last 2 lines read. Make a condition that when both are newlines you break the loop.

Message permanent page

— 

Hello, I need your advise. I need to parse five websites in a single csv. I really don't want to make a class for each parser or a python script, does anyone have such experience? Also, maybe someone has a parser he can show, just curious.

— You only need one parser

— Maybe I'm wrong, but why write several

— Because different DOM, and i need to gather pagination links from some pages beforehand

— I see

— God.. im really tired of workarounds

— Anyone who worked with pylast? I want to extract the last 4 songs a user listened but I get just one

max_results is equal with 4


def get_recents(self, max_results):
recents = self.user.get_recent_tracks(max_results)
for song in recents:
return str(song.track)

Message permanent page

— Every fucking time i think its done, there comes the creature asking for one more feature

— Take it easy

— I've been coding for more than 4 days

— Well stackoverflow then 😂 haven't used the website like in 2 months