0

Hello all...Can u please help me to clear error in this code...

import urllib.request as u import bs4 from urllib.request import Request ,urlopen req =Request("https://in. investing.com/cripto/bitcoin/historical-data",headers={'User-Agent':'Mozilla/5.0'}) y = urlopen(req) soup=bs.4Beautifulsoup,(y,"html,parser") for n in soup(["script","style"]): n.extract() td=Soup.final_all("td") c=[] for K in td: z=(K.get_text()) c.append(z) r=[] for K in range(0,len(c),7): r.append(c[K:K+3]) import x1sxwriter as x wb=x.workbook("one.x1sx") ws=w.badd_worksheet() row=1 ws.write(0,0,"data") ws.write(0,1,"highest") ws.write(0,2,"lowest") for re in range(len(r)): for n in range(3): ws.write(row,n,r[re][n]) row+=1 wb.close() for K in td: z=(k.get_text()) c.append(z) r=[] for K in range(0,len(c),7): r.append(c[k:k+3]) import x1sxwriter as x wb=x.workbook("1.xlsx") ws=wb.add_worksheet() row=1 ws.write(0,0,"date") ws.write(0,1,"highest") ws.write(0,2,"lowest") for re in range (len(r)): for n in range(3): ws.write(row,n,r[re][n])

12th Nov 2021, 4:53 PM
OVIYA A
OVIYA A - avatar
3 Respostas
+ 3
Chances are high that someone will spot the error – but I think you would get help faster if you put the code into ***a script on playground*** instead of pasting it into comments. On playground it would be much more readable.
12th Nov 2021, 6:28 PM
Lisa
Lisa - avatar
+ 2
Do not copy code into the heading – it gets cut off and nobody can read it. But it in a playground script and link it.
12th Nov 2021, 5:25 PM
Lisa
Lisa - avatar
0
ws.write(row,n,r[re][n]) row+=1 wb.close() import os os.system("one.xlsx") out[3]: 0 Vel[4]: import urllib.request as u import os4 from unllio.request import Request,urlopen req=Request("https//investing.com/cripto/bitcoin/historical-data",headers={'User-Agent':'Mozilla/5.0'}")
12th Nov 2021, 5:34 PM
OVIYA A
OVIYA A - avatar