Skip to content

Instantly share code, notes, and snippets.

View ascavalcante80's full-sized avatar

Alexandre Cavalcante ascavalcante80

View GitHub Profile
@ascavalcante80
ascavalcante80 / xpath_webcrawler.py
Created December 13, 2016 13:14
This package contains in class Crawler which provides methods to scrape an URL using a Xpath expression.
import requests
import random
from time import sleep
from lxml import html
import lxml
__author__ = 'alexandre cavalcante'
__version__ = '1.0'
@ascavalcante80
ascavalcante80 / sort_dic.py
Last active August 26, 2016 17:28
sort python dictionaries by value
"""
This scripts give an example of how sort a dictionary by value. It prints the following tuples:
('grape', 1)
('banana',2)
('pineapple',3)
('apple',4)
"""
# by convention, this import should come in the first line, but I put here to make the example clear!
import operator