Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3.  
  4. """Programa que obtiene el saludo de una variable de entorno del SO"""
  5.  
  6. __author__ = 'Gonzalo Chacaltana Buleje'
  7. import os
  8.  
  9. class HelloWorld(object):
  10. """Clase HelloWorld
  11. Attributes:
  12. greeting (str): Atributo que almacena el mensaje Hola Mundo.
  13. """
  14. greeting = ""
  15.  
  16. def __init__(self):
  17. """Método constructor de la Clase HelloWorld
  18. Note:
  19. greeting (str): Almacena la valor de la variable de entorno HELLO_WORLD
  20. """
  21. self.greeting = os.environ['HELLO_WORLD']
  22.  
  23. def print(self):
  24. """Método que imprime el mensaje en pantalla
  25. Returns:
  26. (str) : Mensaje Hola Mundo
  27. """
  28. print (self.greeting)
  29.  
  30. if __name__ == '__main__':
  31. # >> helloWorld.py
  32. # Instanciamos la clase HelloWorld
  33. obj = HelloWorld()
  34. #Imprimimos el saludo
  35. obj.print()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement