skip to Main Content

Json – TypeError: string indices must be intergers

This is the code that is running in app.py @app.route("/", subdomain="dev") def devhome(): with open("D:/moviewebsite/movielist.json", "r") as f: movielist = json.load(f) goodmovies = [] for item in movielist: if str(item["link"])[-4:] == ".mp4": goodmovies.append(item) else: return render_template("devHome.html", movielist=goodmovies) This is a…

VIEW QUESTION

Unable to find text from the html content beautifulsoup

from bs4 import BeautifulSoup import re text = "<tr> <td style="width:127.5pt;padding:3.75pt 0in 3.75pt 0in" width="170"> <p class="MsoNormal"><span style="font-size:11.0pt">Job #<o:p></o:p></span></p> </td> <td style="padding:3.75pt 0in 3.75pt 3.75pt"> <p class="MsoNormal"><strong><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'>TEST-12311</span></strong><span style="font-size:11.0pt"><o:p></o:p></span></p> </td> </tr>" soup = BeautifulSoup(text,"html.parser") print(soup) job_number = soup.find("span", string="Job #")…

VIEW QUESTION
Back To Top
Search