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:
Number: 1
Start time: 00:00:00,659
End time: 00:00:05,429
Text: aberto no começo do ano a presidenta
dilma perto da correção da tabela do
Number: 2
Start time: 00:00:05,429
End time: 00:00:09,660
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
function getParams() { | |
// location.search pega tudo a partir do '?' na url | |
// .slice(1) remove o '?' | |
var queryString = location.search.slice(1); | |
// .split('&') separa o texto pelo caractere & | |
// 'p1=v1&p2=v2'.split('&') => ['p1=v1', 'p2=v2'] | |
var paramsArray = queryString.split('&'); | |
var params = {} |
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
# Python (Django) snippet to update querystrings. Can be used to: | |
# · Replace a value from a querystring key | |
# · Append a value to a querystring key | |
# · Remove a value from a querystring key | |
# · Remove all values from a querystring key | |
# | |
# Assuming: | |
# Python version: 3.x (tested on 3.4) | |
# Django version: 1.8 | |
# App name: app |
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
function parseGET() { | |
/* | |
* Parse url GET parameters and arguments and return them as an object. | |
* Supports multiple values for a same key. | |
* | |
* Examples: | |
* for ?a=1&b=2 | |
* {a: ["1"], b: ["2"]} | |
* for ?type=5&type=10 | |
* {type: ["5", "10"]} |
- item 1 [DONE]
- item 2
- item 1
- item 2
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
Number.prototype.formatThousands = function() { | |
var asStr = this.toString(), | |
floatPart = asStr.match(/^\d+(\.\d+)?$/)[1], | |
re = /^(\d*?)(\d{3})$/; | |
function loop(n) { | |
var match = n.match(re); | |
if (match) { | |
var head = match[1], |
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
/* REQUIRES jQUERY */ | |
// Mask for the area code | |
var patternDDD = /^(\d\d)(.+)/, | |
// Mask for the de facto number | |
patternPhone = /^(\d\d)(\d)?(\d{4})(\d{4})$/; | |
// Sometimes the phone number (especially mobile phones) may have an | |
// additional digit; hence the optional \d in the second group. | |
// Change the id below to your id, or class, or whatever. |
OlderNewer