dimanche 8 décembre 2019

how to assign a variable to each line from a repeating text pattern in python? [closed]

I have a python scrapping script to get infos about some upcomming concerts and it's the same pattern everytime no matter how many concerts will appear, it means that each line will always be referring to a certain information such as:

  • 1st line : date & time of the event
  • 2nd line : name of the band
  • 3rd line: price of the tickets
  • 4th line : location of the arena

so my goal is simple:

  1. For each line I need to assign it to a variable (so 4 variables in total: time, name, price, location)

  2. Then loop through all the events to catch the informations corresponding to each line, such as getting all the dates from the 1st lines, all the names from the 2nd lines ect...

so far I haven't found any solutions yet, and I barely know anything about regex

I hope that you see the idea, don't hesitate if you have any questions thanks

Aucun commentaire:

Enregistrer un commentaire