Sintaxis de python

Multiples sentencias en una sola linea

Contents

Múltiples sentencias en una sola linea

Lo siento, te he mentido, pero ha sido para no confundirte, en Python si usa punto y coma pero solo para diferenciar entre diferentes sentencias y solo si se usan en una sola linea. Esta práctica es lo suficientemente fea como para considerarla mala, pero está ahí y es bueno saberla.

>>> import os; print (os.getcwd())
/Users/markuz

Es mas legible esto:

>>> import os
>>> print (os.getcwd())
/Users/markuz

 


Si te gusta el tutorial, por favor mándame un mensaje, mi twitter: @markuzmx , tal vez te gustó tanto que prefieras hacer una donación via paypal la cantidad tu la pones ? Gracias por apoyarme.

Loading

Please follow and like us:

You must be logged in to take the quiz.

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny