Base de conhecimentoCentro de Exames
PT · PTPortuguês (Portugal)
Escolher idioma13

CKTIS / Python

Base de conhecimento — Python

Sintaxe, operadores e conceitos de programação. Encontra uma explicação, consulta um exemplo e continua a aprender.

Entradas: 583

Python

str.title

Inicia cada grupo de letras na forma de título e converte as seguintes em minúsculas.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

str.upper

Devolve o texto em maiúsculas Unicode.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

str.zfill

Preenche com zeros ASCII até à largura mínima width.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

sys.stdout — o fluxo de saída padrão

sys.stdout é o fluxo de texto do Python para a saída padrão, utilizado por omissão por print(). Permite escrever texto diretamente e esvaziar o buffer; não tem necessariamente de apontar para um terminal.

Básico · Python 3.14; repository image, production runtime not attested
Python

timeit.repeat

repeat devolve uma lista de durações pela ordem dos ensaios.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

timeit.timeit

timeit mede a duração total de number execuções de uma instrução ou de uma função sem argumentos.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

timeit.Timer

Timer guarda a instrução e a preparação como texto ou funções sem argumentos.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

type.__name__

Este atributo de classe dá o nome simples do tipo sem módulo nem classes envolventes.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

typing.Annotated

Associa metadados ordenados a um tipo de base.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

typing.Any

Representa um valor de tipo dinâmico.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

typing.Callable

Descreve um objeto invocável pelos tipos dos argumentos e do resultado.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

typing.cast

Indica ao verificador o tipo presumido de uma expressão.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

typing.ClassVar

Assinala um atributo de classe cuja atribuição através de uma instância o verificador rejeita.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

typing.Dict — anotação de dicionário legada

typing.Dict descreve os tipos das chaves e dos valores de um dicionário. Desde Python 3.9, é um alias obsoleto de dict; use dict[K, V] no código novo. A anotação não valida dados durante a execução.

Básico · Python 3.14; repository image, production runtime not attested
Python

typing.Final

Declara um nome cuja reatribuição ou substituição numa subclasse é rejeitada pelo verificador.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

typing.Generic

A base Generic[T] declara uma classe com uma variável de tipo T criada anteriormente.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

typing.List — anotação de tipo de lista legada

typing.List[T] descreve uma lista de elementos do tipo T. Continua disponível no Python 3.14, mas o código novo deve preferir list[T].

Básico · Python 3.14; repository image, production runtime not attested
Python

typing.Literal

Restringe um tipo estático a determinados valores literais.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

typing.NamedTuple

Cria uma subclasse imutável de tuple com campos nomeados e anotados também acessíveis por índice ou desempacotamento.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

typing.Never

O tipo vazio não tem valores possíveis.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

typing.NewType

Cria um subtipo estático distinto, por exemplo para um identificador baseado em int.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

typing.NotRequired

Permite omitir uma chave específica de TypedDict mesmo quando as restantes são obrigatórias por predefinição.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

typing.Optional

Admite um valor de tipo T ou None como a união dos dois tipos.

Intermédio · Python 3.14; repository image, production runtime not attested
Python

typing.overload

Declara para o verificador relações alternativas entre os tipos dos argumentos e o resultado.

Intermédio · Python 3.14; repository image, production runtime not attested