This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.request | |
import json | |
def search(texto): | |
#pegue o access_token | |
#em https://developers.facebook.com/tools/explorer | |
url = 'https://graph.facebook.com/search?q=' | |
tail = '&type=post&access_token=<copie aqui o access_token>' | |
resp = urllib.request.urlopen(url+texto+tail).read() | |
data = json.loads(resp.decode('utf-8')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.request | |
import json | |
def grava_imagem(amigo): | |
size = '/picture?width=200&height=200' | |
url = 'https://graph.facebook.com/'+ amigo['id'] + size | |
figura = urllib.request.urlopen(url).read() | |
f = open(amigo['name'] + '.jpg', 'wb') | |
f.write(figura) | |
f.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.request | |
import json | |
#copie o formato no exemplo e pegue o access_token | |
#em https://developers.facebook.com/tools/explorer | |
url = 'copie aqui o link Connections Friends' | |
resp = urllib.request.urlopen(url).read() | |
data = json.loads(resp.decode('utf-8')) | |
for amigo in data['data']: | |
print (amigo['name']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.request | |
import json | |
user = 'marcelcaraciolo' | |
url = 'https://graph.facebook.com/'+user+'/picture?type=large' | |
figura = urllib.request.urlopen(url).read() | |
arquivo = user + '.jpg' | |
f = open (arquivo, 'wb') | |
f.write(figura) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.request | |
import json | |
from pprint import pprint | |
url = 'https://graph.facebook.com/marcelcaraciolo' | |
resp = urllib.request.urlopen(url).read() | |
data = json.loads(resp.decode('utf-8')) | |
pprint (data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.request | |
import json | |
url = 'http://api.icndb.com/jokes/random?limitTo=[nerdy]' | |
resp = urllib.request.urlopen(url).read() | |
data = json.loads(resp.decode('utf-8')) | |
print (data['value']['joke']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arq = open('alice.txt') | |
texto = arq.read() | |
texto = texto.lower() | |
import string | |
for c in string.punctuation: | |
texto = texto.replace(c, ' ') | |
texto = texto.split() | |
dic = {} | |
for p in texto: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
nomes = '''Júlia Sophia Isabella Manuela Giovanna Alice Laura | |
Luiza Beatriz Mariana Yasmin Gabriela Rafaela Isabelle Lara | |
Letícia Valentina Nicole Sarah Vitória Isadora Lívia Helena | |
Lorena Clara Larissa Emanuelly Heloisa Marina Melissa Gabrielly | |
Eduarda Rebeca Amanda Alícia Bianca Lavínia Fernanda Ester | |
Carolina Emily Cecília Pietra Milena Marcela Laís Natália | |
Maria Bruna Camila Luana Catarina Olivia Agatha Mirella | |
Sophie Stella Stefany Isabel Kamilly Elisa Luna Eloá Joana | |
Mariane Bárbara Juliana Rayssa Alana Caroline Brenda Evelyn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint | |
print ('Bem vindo!') | |
sorteado = randint(1, 100) | |
chute = 0 | |
while chute != sorteado: | |
chute = int(input ('Chute: ')) | |
if chute == sorteado: | |
print ('Você venceu!') | |
else: | |
if chute > sorteado: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
import urllib | |
from BeautifulSoup import BeautifulSoup | |
import cookielib | |
import requests | |
import re | |
URL_BASE = 'http://coursetalk.org/' | |
cursos = None | |
ratings = None |