“Hoja de trucos Python” Código de respuesta

Hoja de trucos Python

def foo():
    """
    This is a function docstring
    You can also use:
    ''' Function Docstring '''
    """
DevLorenzo

Hoja de trucos Python

a = 1  # initialization
DevLorenzo

Hoja de trucos Python

>>> spam = 'Hello'
>>> spam
'Hello'
DevLorenzo

Hoja de trucos Python

>>> print('Hello world!')
Hello world!
DevLorenzo

Hoja de trucos Python

>>> print('What is your name?')   # ask for their name
>>> myName = input()
>>> print('It is good to meet you, {}'.format(myName))
What is your name?
Al
It is good to meet you, Al
DevLorenzo

Hoja de trucos Python

# This is a
# multiline comment
DevLorenzo

Hoja de trucos Python

>>> a = [1, 2, 3]
>>> if a:
>>>     print("the list is not empty!")
DevLorenzo

Hoja de trucos Python

>>> 'Alice' 'Bob'
'AliceBob'
DevLorenzo

Hoja de trucos Python

>>> _spam = 'Hello'
DevLorenzo

Hoja de trucos Python

>>> str(-3.14)
'-3.14'
DevLorenzo

Respuestas similares a “Hoja de trucos Python”

Preguntas similares a “Hoja de trucos Python”

Más respuestas relacionadas con “Hoja de trucos Python” en Python

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código