python&pygame Snake source code

caidan_youxi.py import sys import pygame from PyQt5.QtWidgets import QApplication, QMainWindow import login if __name__ == ‘__main__’: pygame.init() pygame.mixer.init() pygame.mixer.music.load(‘C:/Users/ShiWe/Desktop/Computer Software Technology Internship/tanchishe/bgm.mp3′) # Load songs pygame.mixer.music.play() # Play app = QApplication(sys.argv) win = QMainWindow() loginUi = login.Ui_MainWindow() loginUi.setupUi(win) win.show() sys.exit(app.exec_()) youxi.py f = open(“speed.txt”, mode=’r’) speed = f.read() f.close() score = 0 import pygame as […]

Python3 operating file series (2): file data reading and writing | binary data reading and writing

Python3 operating file series (1): Three ways to determine whether a file|directory exists Python3 operating file series (2): file data reading and writing | binary data reading and writing Python3 data file reading and writing Python3 file operation series (3): reading and writing data from excel files One: File data|Binary data reading and writing import […]

7 Best Python Libraries for Artificial Intelligence Development

[Introduction]Python is the first choice for developing artificial intelligence projects. This programming language provides optimal security, performance, and scalability needed to develop advanced artificial intelligence projects. Numpy NumPy(Numerical Python) is an extension library for Python, and most AI developers consider NumPy to be the best Python library for developing a range of solutions. Developing AI […]

python&pygame random maze automatic path finding based on A* algorithm

caidan_youxi.py import sys import pygame from PyQt5.QtWidgets import QApplication, QMainWindow import login if __name__ == ‘__main__’: pygame.init() pygame.mixer.init() pygame.mixer.music.load(‘bgm.mp3’) # Load songs pygame.mixer.music.play() # Play app = QApplication(sys.argv) win = QMainWindow() loginUi = login.Ui_MainWindow() loginUi.setupUi(win) win.show() sys.exit(app.exec_()) my_migong.py import pygame import random import numpy as np import time class point: def __init__(self, row=0, col=0): self.row […]

Python query Prometheus API

#!/bin/python # -*- coding: utf-8 -*- import pandas as pd import requests, time, re def getcolumn(status, x): if float(status) < 80: return “normal” # elif float(status) < 2: # return “Exception” else: return “Exception” def query(url, promql): “”” Not recommended: params = ‘query=round(100-(avg(irate(node_cpu_seconds_total{mode=”idle”}[5m])) by (instance,nodename) * 100 ),0.01)’ :param url: :param promql: PromQL expression :return: […]

Python implements AES algorithm and national secret SM4 algorithm

This article mainly introduces the Python implementation and shell script implementation of the AES encryption algorithm, and the Python implementation of the SM4 national secret algorithm. Python uses pycryptodome to implement AES encryption and decryption, and GmSSL to implement the SM4 encryption and decryption algorithm; the Shell script uses openssl to implement AES encryption and […]

Python big data PySpark (6) RDD operation

Article directory RDD operations Function classification Transformation function Action function Basic exercises [Wordcount quick demonstration] Transformer operator Action operator important function postscript RDD operations Function classification *The Transformation operation only establishes the calculation relationship, and the Action operation is the actual executor*. Transformation operator conversion operator There is no conversion between operations. If you want […]