jeudi 3 septembre 2020

for and if in pythonI want an answer or Alternative answer sql [closed]

Take out unexpected

for a in soouppp.find_all('a', href=True):    
                  name=a.text
                  datalink=a['data-link']
                  end=requests.get(ls + str(datalink))
                  souls = BeautifulSoup(end.content, "html.parser")                     
                  for iframe in souls.find_all('iframe', src=True): 
                      liko="".join(lik.split("http://"))    
                      if liko.startswith('as'):
                          as=liko.split("/")[1]
                          print('as',as)                                           
                      if liko.startswith('www.a'):
                          a= liko.split("/")[1]
                          print('a',  a)
                      if liko.startswith('b'):
                          b=liko.split("/")[1]
                          print('b',  b)
                      if liko.startswith('c'):
                          c=liko.split("/")[1] 
                          print('c',c)

output: #True

 aas jhbn4rf4 
 a flgkldfg9
 b fds9gdf
 c kjhu78

if:

                  if liko.startswith('aas'):
                      aas=liko.split("/")[1]                                                                     
                  if liko.startswith('www.a'):
                      a= liko.split("/")[1]                          
                  if liko.startswith('b'):
                      b=liko.split("/")[1]
                  if liko.startswith('c'):
                      c=liko.split("/")[1]                           
                  print(as,a,b,c)

output: #fault #minus Tried all the prefix lines

or Append a column record separately #sql #How do

Aucun commentaire:

Enregistrer un commentaire