Advertisement
NubeColectiva

Verificar Si Una Variable de Tipo String Está Vacia en Python

Jul 2nd, 2023 (edited)
1,382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. """
  2. # Ejemplo 1
  3. producto = "Zapatos marrones de cuero"
  4.  
  5. if producto == "":
  6.    print("La variable está vacia")
  7. else:
  8.    print("La variable no está vacia")
  9. """
  10.  
  11. #Ejemplo 2
  12.  
  13. usuario = "Carlos Torres"
  14.  
  15. if not usuario:
  16.     print("La variable esta vacia")
  17. else:
  18.     print("La variable no esta vacia")
  19.  
Tags: python String
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement