[Python] Python Data Scraping

Discussão em 'Python' iniciado por Stack, Março 20, 2025.

  1. Stack

    Stack Membro Participativo

    Data Scraping in Pyhton. Code is working fine but it is showing the error which I mentioned below. What could be the reason?

    import urllib2
    from bs4 import BeautifulSoup
    from xlwt import workbook

    wb = Workbook()
    sheet1 = wb.add_sheet('Sheet1')

    soup = BeautifulSoup(urllib2.urlopen("http://en.wikipedia.org/wiki/List_of_Indian_satellites").read())

    for row in soup('table', {'class': 'wikitable sortable jquery-tablesorter’})[0].tbody('tr'):
    tds = row('td')
    sheet1.write(row, 0, tds[0].string)
    sheet2.write(row, 1, tds[1].string)

    wb.save('Performance Project.xls')


    Error: File "ProcessingProject.py", line 12 SyntaxError: Non-ASCII character '\xe2' in file ProcessingProject.py on line 12
    ​

    but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

    Continue reading...

Compartilhe esta Página