# import datetime # print(datetime.date.today()) # print(datetime.timedelta(minutes=70)) from datetime import timedelta, date # import fmath from fmath import add, substract from colorama import Fore, Back, Style, init add(1, 2) substract(1, 2) print(date.today()) init(convert=True) print(Fore.RED + 'Hello World')
from fmath import add, substract add(2,1) substract(2,1)
# own modules # third party modules # python modules # Módulos preconstruidos from datetime import timedelta, date # import fmath from fmath import add, substract from colorama import Fore, Style, init init(convert=True) print(date.today()) add(3, 3) substract(3, 1) print(Fore.RED + "Hello world") print(Fore.YELLOW + "Hello world") print(Fore.BLUE + "Hello world") print(Fore.GREEN + "Hello world")
# own modules # third party modules # python modules # import module import datetime # https://docs.python.org/3/tutorial/modules.html # https://docs.python.org/3/py-modindex.html print(datetime.date.today()) print(datetime.timedelta(minutes=70)) from datetime import timedelta print(timedelta(minutes=70)) from datetime import date as dt print(dt.today()) import fmath fmath.add(1,2) fmath.substract(2,3) # flask: framework for web apps # django: framework # tkinter
# Importado el modulo datetime import datetime print(datetime.date.today()) print(datetime.timedelta(minutes=100)) #Otra forma de importar el timedelta from datetime import timedelta print(timedelta(minutes=60)) #Importando modulos creados por el usuario import fmath print(fmath.add(1, 2)) print(fmath.substract(1, 2))
#modulos propios #modulos para descargar de internet #modulos desde la biblioteca de python #fecha actual con modulo de python # import datetime # print(datetime.date.today()) # print(datetime.timedelta(minutes=60)) # print(datetime.time()) #forma uno importando todo de fmath import fmath fmath.add(1, 2) fmath.substract(3, 1) #forma dos entrando a fmath y sacando las funciones from fmath import add, substract substract(1, 2) #pip install colorama en consola descarga ese modulo
from fmath import add, substract substract(4, 5) add(8, 9) # thirdy party modules from colorama import Fore, Style, init init(convert=True) print(Fore.RED + "JAALOOO") # python modules import datetime from datetime import timedelta, date print(datetime.timedelta(minutes=365))
# modulos o bibliotecas #own modules # thirdy party modules # python modules # Trae toda la libreria import datetime #from datetime import timedelta, date print(datetime.date.today()) print(datetime.timedelta(minutes=180)) # Import custom modules import fmath #from fmath import add, substract #add(1,2) #substract(12, 65) fmath.add(10, 5) fmath.substract(15, 35)
#Modules from datetime import timedelta, date from fmath import add, substract, divide, multiple # print(timedelta(minutes= 100)) # print(date.today()) print(add(2, 4)) print(substract(10, 7)) print(divide(10, 5)) print(multiple(5, 5))
#another example. #another way of call methods. from datetime import timedelta print(timedelta(minutes=100) ) # you dont have to call datatime, you call direclty de module. # print(datetime.timedelta(minutes=100)) #another example from datetime import timedelta, date #we have added more modules to avoid call any time print(date.today()) #my own module, verify from fmath.py import fmath fmath.substract(1, 2) #another example from fmath import substract, add substract(5, 6) add(4, 5) #note with pip command you can install thirdy part modules
# IMPORTANTES PARA CREAR APLICACIONES # Cualquiera de los 3 son totalmente útiles y válidos # Own modules # Ir a fmath.py para ver el módulo que creamos... # Simplemene lo llamamos import fmath fmath.add(20, 30) from fmath import add, substract substract(55, 30) add(55, 30) # Thirdy party modules # Módulos de otros usuarios osea de terceros # Buscamos pypi en google... # El proceso de instalación es a traves de la consola... from colorama import Fore, Style, init init(convert=True) print(Fore.RED + "Hello World") # Python modules # Se puede investigar para ver el monton que existen, por ejemplo... import datetime
# Muesta la fecha de hoy import time from datetime import date today = date.today() print(today) # Muesta la fecha de hoy import datetime print(datetime.date.today()) #el método es date y el parámetro es today # Muesta la fecha de hoy from datetime import date print(date.today()) #converts minutes to hours import datetime print(datetime.timedelta(minutes=100)) #convert minutes to hours print(datetime.timedelta(days=1)) print(datetime.timedelta(weeks=1)) #shows 7 days print(datetime.timedelta(hours=100)) #shows 4 days 4:00:00 hours print(datetime.timedelta(seconds=100)) #converts seconds to minutes # importamos nuestro módulo con sus dos funciones import fmath fmath.add(3, 2) #devuelve 5 fmath.substract(3, 2) #devuelve 1 # Importo un módulo propio from fmath import add, substract add(5, 3) # shows substract(5, 3)