Category: Python

  • How to work with python pickle

    Python pickle is an essential tool for serializing and de-serializing Python objects, such as lists, dictionaries, and custom objects, offering a seamless method to store and retrieve data with efficiency. So we can easily store python lists,dictionary and frequently used object which need to be stored. Pickle is fast is efficient. Evan I have made…

  • How To Add Static Files And Templates Folder In Python Tornado

    In this program example we will use template_path=os.path.join(os.path.dirname(__file__), “templates”) this code to set the templates folder location In the same way we will set the static path static_path=os.path.join(os.path.dirname(__file__), “static”) And we will add this in the tornado application tornado.web.Application() This is the full app.py where templates folder and static folder added import tornado.web from tornado.options…

  • How To Set Background Color In Pygame

    import pygame,sys from pygame.locals import* pygame.init() screen=pygame.display.set_mode((600,400)) game_running=True while game_running: for event in pygame.event.get(): if event.type==QUIT: pygame.quit() sys.exit() screen.fill((255,250,240)) pygame.display.update() Copy Lets write the step by step full code and explanation First import necessary library And then initiate the pygame Set the our game display resolution Set the game in a loop so it will…