import csv
from urllib.request import urlopen
from urllib.error import HTTPError
from bs4 import BeautifulSoup


def getTableRows(url):
    try:
        html = urlopen(url)
    except HTTPError as e:
        return None
    try:
        bsObj = BeautifulSoup(html)
        table = bsObj.findAll('table', {'class': 'wikitable'})[0]
        rows = table.findAll('tr')
    except AttributeError as e:
        return None
    return rows


url = input('Enter URL(Press Enter to redirect to default URL): ')
if url == '':
    url = 'http://en.wikipedia.org/wiki/Comparison_of_text_editors'
rows = getTableRows(url)
csvFile = open('editors.csv', 'wt')
writer = csv.writer(csvFile)
try:
    for row in rows:
        csvRow = []
        for cell in row.findAll(['td', 'th']):
            csvRow.append(cell.get_text())
            writer.writerow(csvRow)
finally:
    csvFile.close()

2c2e0044cb7429a0acdfec32ab68a2d796e967ac
<mask token>

<mask token>


def getTableRows(url):
    try:
        html = urlopen(url)
    except HTTPError as e:
        return None
    try:
        bsObj = BeautifulSoup(html)
        table = bsObj.findAll('table', {'class': 'wikitable'})[0]
        rows = table.findAll('tr')
    except AttributeError as e:
        return None
    return rows


<mask token>
if url == '':
    url = 'http://en.wikipedia.org/wiki/Comparison_of_text_editors'
<mask token>
try:
    for row in rows:
        csvRow = []
        for cell in row.findAll(['td', 'th']):
            csvRow.append(cell.get_text())
            writer.writerow(csvRow)
finally:
    csvFile.close()

<mask token>


def getTableRows(url):
    try:
        html = urlopen(url)
    except HTTPError as e:
        return None
    try:
        bsObj = BeautifulSoup(html)
        table = bsObj.findAll('table', {'class': 'wikitable'})[0]
        rows = table.findAll('tr')
    except AttributeError as e:
        return None
    return rows


url = input('Enter URL(Press Enter to redirect to default URL): ')
if url == '':
    url = 'http://en.wikipedia.org/wiki/Comparison_of_text_editors'
rows = getTableRows(url)
csvFile = open('editors.csv', 'wt')
writer = csv.writer(csvFile)
try:
    for row in rows:
        csvRow = []
        for cell in row.findAll(['td', 'th']):
            csvRow.append(cell.get_text())
            writer.writerow(csvRow)
finally:
    csvFile.close()

import csv
from urllib.request import urlopen
from urllib.error import HTTPError
from bs4 import BeautifulSoup


def getTableRows(url):
    try:
        html = urlopen(url)
    except HTTPError as e:
        return None
    try:
        bsObj = BeautifulSoup(html)
        table = bsObj.findAll('table', {'class': 'wikitable'})[0]
        rows = table.findAll('tr')
    except AttributeError as e:
        return None
    return rows


url = input('Enter URL(Press Enter to redirect to default URL): ')
if url == '':
    url = 'http://en.wikipedia.org/wiki/Comparison_of_text_editors'
rows = getTableRows(url)
csvFile = open('editors.csv', 'wt')
writer = csv.writer(csvFile)
try:
    for row in rows:
        csvRow = []
        for cell in row.findAll(['td', 'th']):
            csvRow.append(cell.get_text())
            writer.writerow(csvRow)
finally:
    csvFile.close()
