Em Python 2.x, essas funções devolvem listas enquanto que, em Python 3, devolvem
geradores. Para usar estes geradores como listas (assim como em Python 2.x),
apenas aplique list
ao resultado.
Por exemplo:
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
# | |
# I was given about 10 minutes to figure out an exercise that | |
# boiled down to merging named tuples | |
# | |
# Weird thing to expect someone to know. Certainly anyone who knows this | |
# off the top of their head knows a lot about Python. But not everyone | |
# good developer will know this little corner of Python. | |
# | |
# It took me some time inspecting tuples to come up with this approach, slowed | |
# by my discomfort with relying on single-underscore members of library objects |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from flask import Flask, request | |
from urllib import unquote_plus | |
import json | |
import re | |
app = Flask(__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
// Variables A1-A5 are reserved on Arduino, So I renamed my Ax notes to AAx. | |
// Rights to the song obviously don't belong to me. blah blah, legal words, blah blah. | |
const int C2 = 65; | |
const int Db2 = 69; | |
const int D2 = 73; | |
const int Eb2 = 78; | |
const int E2 = 82; | |
const int F2 = 87; | |
const int Gb2 = 93; |
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
/******************************************************************* | |
* An example of bot that receives commands and turns on and off * | |
* an LED. Mod to control AC with SSR, and read from DHT22 * | |
* * | |
* written by Giacarlo Bacchio (Gianbacchio on Github) * | |
* adapted by Brian Lough * | |
* mod by teos00009 * | |
*******************************************************************/ | |
//arduinojson on v1.8.0 |
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
/* | |
This complex software code was amended by AABIDA Abderrahim To fit Shield L293D v1 , Please mention the source of this code maker Because of the effort he spent to modify this code . | |
My Email : [email protected] | |
my compte Facebook : https://www.facebook.com/Abderrahim.Aabida | |
Mini CNC Plotter firmware, based in TinyCNC https://github.com/MakerBlock/TinyCNC-Sketches | |
Send GCODE to this Sketch using gctrl.pde https://github.com/damellis/gctrl | |
Convert SVG to GCODE with MakerBot Unicorn plugin for Inkscape available here https://github.com/martymcguire/inkscape-unicorn | |
More information about the Mini CNC Plotter here (german, sorry): http://www.makerblog.at/2015/02/projekt-mini-cnc-plotter-aus-alten-cddvd-laufwerken/ | |
*/ |
Alguém na lista Python-Brasil perguntou sobre como criar um webservice Restful com Python... eu achei interessante salvar as sugestões aqui para indicar, caso essa questão apareça em algum lugar.
A ideia é também atualizar esse arquivo com algum blogpost que contribua para a questão.
- Documentação -> http://flask.pocoo.org
- Extensão util -> http://flask-restful.readthedocs.org
- Exemplo -> http://blog.miguelgrinberg.com/post/designing-a-restful-api-using-flask-restful
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
const int c = 261; | |
const int d = 294; | |
const int e = 329; | |
const int f = 349; | |
const int g = 391; | |
const int gS = 415; | |
const int a = 440; | |
const int aS = 455; | |
const int b = 466; | |
const int cH = 523; |