python项目开发案例集锦,python项目案例代码

这篇文章主要介绍了python项目开发案例集锦(全彩版),具有一定借鉴价值,需要的朋友可以参考下。希望大家阅读完这篇文章后大有收获,下面让小编带着大家一起了解一下。

前言

22个通过Python构建的项目,以此来学习Python编程。

① 骰子模拟器

目的:创建一个程序来模拟掷骰子。

提示:当用户询问时,使用random模块生成一个1到6之间的数字。

import random;
while int(input( 'Press 1 to roll the dice or 0 to exit:\n')): print(random.randint(1,6))
--------------------------------------------------------------------
Press 1 to roll the dice or e to exit

② 石头剪刀布游戏

目标:创建一个命令行游戏,游戏者可以在石头、剪刀和布之间进行选择,与计算机PK。如果游戏者赢了,得分就会添加,直到结束游戏时,最终的分数会展示给游戏者。

提示:接收游戏者的选择,并且与计算机的选择进行比较。计算机的选择是从选择列表中随机选取的。如果游戏者获胜,则增加1分。

import random
choices = ["Rock", "Paper", "Scissors"]
computer = random.choice(choices)
player = False
cpu_score = 0
player_score = 0
while True:player = input("Rock, Paper or  Scissors?").capitalize()# 判断游戏者和电脑的选择if player == computer:print("Tie!")elif player == "Rock":if computer == "Paper":print("You lose!", computer, "covers", player)cpu_score+=1else:print("You win!", player, "smashes", computer)player_score+=1elif player == "Paper":if computer == "Scissors":print("You lose!", computer, "cut", player)cpu_score+=1else:print("You win!", player, "covers", computer)player_score+=1elif player == "Scissors":if computer == "Rock":print("You lose...", computer, "smashes", player)cpu_score+=1else:print("You win!", player, "cut", computer)player_score+=1elif player=='E':print("Final Scores:")print(f"CPU:{cpu_score}")print(f"Plaer:{player_score}")breakelse:print("That's not a valid play. Check your spelling!")computer = random.choice(choices)

③ 随机密码生成器

目标:创建一个程序,可指定密码长度,生成一串随机密码。

提示:创建一个数字+大写字母+小写字母+特殊字符的字符串。根据设定的密码长度随机生成一串密码。

import random
passlen = int(input( "enter the length of password" ))
s="abcdefghijklmnopqrstuvwxyz01234567890ABCDEFGHIJKLNNOPQRSTUVWXYZ!@#$%^&*()?
p= "".join(random.sample(s,passlen ))
print (p)
----------------------------------------------aw--enter the length of password
za1gBo

④ 句子生成器

目的:通过用户提供的输入,来生成随机且唯一的句子。

提示:以用户输入的名词、代词、形容词等作为输入,然后将所有数据添加到句子中,并将其组合返回。

color = input("Enter a color: ")
pluralNoun = input("Enter a plural noun: )celebrity = input(“Enter a celebrity: ")print("Rases are", color)
print(pluralNoun i - are blue-)
print(I love-, celebrity)
-------------------------------------
Red
Teeth
RDJ
Roses are red. teeth are blue.I Love RDJ

⑤ 猜数字游戏

目的:在这个游戏中,任务是创建一个脚本,能够在一个范围内生成一个随机数。如果用户在三次机会中猜对了数字,那么用户赢得游戏,否则用户输。

提示:生成一个随机数,然后使用循环给用户三次猜测机会,根据用户的猜测打印最终的结果。

import random
nu nber = randomn.randint(1,10)for i in range(0,3):
user = int(input("guess the nunber"))if user number:
print("Hurray !")
print(f"you guessed the number right it's {nunber ")break
elif user>number:
print("Your guess is too high" )clif user<number :
print("Your guess is toa low.")
else:
print( f"Nice Try!, but the nunber is {number}")

⑥ 故事生成器

目的:每次用户运行程序时,都会生成一个随机的故事。

提示:random模块可以用来选择故事的随机部分,内容来自每个列表里。

import random
when = [ 'A few years ago',"Yesterday','Last night', 'A long time ago' , ' n 2eth Jan']who = [ 'a rabbit', 'an elephant ', 'a mouse", "a turtie' , 'a cat']
namne =[ 'Ali',_"Miriam " , 'daniel ,"Hoouk ' , 'starwalker"j
residence = ['Barcelona ", ' India', "Germany", "venice', 'England']went = [ 'cinema " , "university' , ' seminar ', "school" , 'laundry"]
happened = [ 'made a lot of friends ' , ' Eats a burger', 'found a secret key', 'solved a mistery',"wrote a book ']
print( random. choice(when) : ' ' +random. choice(who) + " that lived in "+random.choice(residence) + ',went to the ' + random.choice(went ) + " and ' +random .choice( happened)
-------------------------------OUTPUT---------------------------------------
A long time ago,a cat that lived in England,went to the seminar and solved a mistery

⑦ 邮件地址切片器

目的:编写一个Python脚本,可以从邮件地址中获取用户名和域名。

提示:使用@作为分隔符,将地址分为分为两个字符串。

#Get the usor's email address
email = input(what is your email address  ").stripO
# Slice out the user name
user _name = emaill:enail.indexCa-1
#SLice out the domain name
domain_nane = emaillomail.index(a")+1:]
#Format message
res = f"Your uSorname is "{user_nama}” and your domin namo is "{domin_name}""
#Display the result message
print(res)
-------------------OUTPUT-----------------------------------------
what is your email addressr: karl31agmail.com
Your username is‘karl31 " and your domain name is "gmail.com

⑧ 自动发送邮件

目的:编写一个Python脚本,可以使用这个脚本发送电子邮件。

提示:email库可用于发送电子邮件。

import smtplib 
from email.message import EmailMessage
email = EmailMessage() ## Creating a object for EmailMessage
email['from'] = 'xyz name'   ## Person who is sending
email['to'] = 'xyz id'       ## Whom we are sending
email['subject'] = 'xyz subject'  ## Subject of email
email.set_content("Xyz content of email") ## content of email
with smtlib.SMTP(host='smtp.gmail.com',port=587)as smtp:     
## sending request to server smtp.ehlo()          ## server object
smtp.starttls()      ## used to send data between server and client
smtp.login("email_id","Password") ## login id and password of gmail
smtp.send_message(email)   ## Sending email
print("email send")    ## Printing success message

⑨ 缩写词

目的:编写一个Python脚本,从给定的句子生成一个缩写词。

提示:你可以通过拆分和索引来获取第一个单词,然后将其组合。

#Get the user's email address
oaail = input(what is your cail addross n ").stripOO
#Slice out Lhe user nalme
user_name = caail[reaail-indexC"a)]
# Slice out the domain name
domain_nane = emaillenail.indexC"a"+1:]Format message
res = f"Your username is "{user_name}’ and your domain name is "{domain_name}"" Display the result message
print(res)
-----------------------OUTPUT------------------------------------
what is your emailaddressr: karl310gmail.com
Your username is "karL31" and your domain name is ‘gmai1l.com"

⑩ 文字冒险游戏

目的:编写一个有趣的Python脚本,通过为路径选择不同的选项让用户进行有趣的冒险。

name - str(input("Enter Your NameMn-))
print(f"{name} you are stuck in a forest. Your task is to get out from the forest withoutdieing
print( You are walking threw forest and suddenly a wolf comes in your way. Now You have twooptions.-)
print("1-Run 2. Climb The Moarest Tree ")
user = int(input("Choose one option 1 or 2"32if user—1:
print("You Died m")elif user-2:
printd"You survived H-)else:
printK"Incorrect Input-)
#### Add a loop and increase the story as much as you can

⑪ Hangman

目的:创建一个简单的命令行hangman游戏。

提示:创建一个密码词的列表并随机选择一个单词。现在将每个单词用下划线“”表示,给用户提供猜单词的机会,如果用户猜对了单词,则将“”用单词替换。

import time
import random
name = input("What is your name? ")
print ("Hello, " + name, "Time to play hangman!")
time.sleep(1)
print ("Start guessing...\n")
time.sleep(0.5)
## A List Of Secret Words
words = ['python','programming','treasure','creative','medium','horror']
word = random.choice(words)
guesses = ''
turns = 5
while turns > 0:         failed = 0             for char in word:      if char in guesses:    print (char,end="")    else:print ("_",end=""),     failed += 1    if failed == 0:        print ("\nYou won") break              guess = input("\nguess a character:") guesses += guess                    if guess not in word:  turns -= 1        print("\nWrong")    print("\nYou have", + turns, 'more guesses') if turns == 0:           print ("\nYou Lose") 

⑫ 闹钟

目的:编写一个创建闹钟的Python脚本。

提示:你可以使用date-time模块创建闹钟,以及playsound库播放声音。

from datetime import datetime   
from playsound import playsound
alarm_time = input("Enter the time of alarm to be set:HH:MM:SS\n")
alarm_hour=alarm_time[0:2]
alarm_minute=alarm_time[3:5]
alarm_seconds=alarm_time[6:8]
alarm_period = alarm_time[9:11].upper()
print("Setting up alarm..")
while True:now = datetime.now()current_hour = now.strftime("%I")current_minute = now.strftime("%M")current_seconds = now.strftime("%S")current_period = now.strftime("%p")if(alarm_period==current_period):if(alarm_hour==current_hour):if(alarm_minute==current_minute):if(alarm_seconds==current_seconds):print("Wake Up!")playsound('audio.mp3') ## download the alarm sound from linkbreak

⑬ 有声读物

目的:编写一个Python脚本,用于将Pdf文件转换为有声读物。

提示:借助pyttsx3库将文本转换为语音。

安装:pyttsx3,PyPDF2

import pyttsx3,PyPDF2
pdfReadar = PyPDF2.PdfFileReader(open("file.pdf', "rb'))speaker = pyttsxs3.inito
for page_nim inrange(pdFReader.numPages):
text = pdfReader.getPage(page_nn).extractrext(speaker.say(text
speaker.runAndaitospeaker.stop()

⑭ 天气应用

目的:编写一个Python脚本,接收城市名称并使用爬虫获取该城市的天气信息。

提示:你可以使用Beautifulsoup和requests库直接从谷歌主页爬取数据。

安装:requests,BeautifulSoup

from bs4 import BeautifulSoup
import requests
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'}def weather(city):city=city.replace(" ","+")res = requests.get(f'https://www.google.com/search?q={city}&oq={city}&aqs=chrome.0.35i39l2j0l4j46j69i60.6128j1j7&sourceid=chrome&ie=UTF-8',headers=headers)print("Searching in google......\n")soup = BeautifulSoup(res.text,'html.parser')   location = soup.select('#wob_loc')[0].getText().strip()  time = soup.select('#wob_dts')[0].getText().strip()       info = soup.select('#wob_dc')[0].getText().strip() weather = soup.select('#wob_tm')[0].getText().strip()print(location)print(time)print(info)print(weather+"°C") print("enter the city name")
city=input()
city=city+" weather"
weather(city)

⑮ 人脸检测

目的:编写一个Python脚本,可以检测图像中的人脸,并将所有的人脸保存在一个文件夹中。

提示:可以使用haar级联分类器对人脸进行检测。它返回的人脸坐标信息,可以保存在一个文件中。

安装:OpenCV。

下载:haarcascade_frontalface_default.xml

https://raw.githubusercontent.com/opencv/opencv/master/data/haarcascades/haarcascade_frontalface_default.xml

import cv2
# Load the cascade
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
# Read the input image
img = cv2.imread('images/img0.jpg')
# Convert into grayscale
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# Detect faces
faces = face_cascade.detectMultiScale(gray, 1.3, 4)
# Draw rectangle around the faces
for (x, y, w, h) in faces:cv2.rectangle(img, (x, y), (x+w, y+h), (255, 0, 0), 2)crop_face = img[y:y + h, x:x + w]  cv2.imwrite(str(w) + str(h) + '_faces.jpg', crop_face)
# Display the output
cv2.imshow('img', img)
cv2.imshow("imgcropped",crop_face)
cv2.waitKey()

⑯ 提醒应用

目的:创建一个提醒应用程序,在特定的时间提醒你做一些事情(桌面通知)。

提示:Time模块可以用来跟踪提醒时间,toastnotifier库可以用来显示桌面通知。

安装:win10toast

from win10toast import ToastNotifier
import time
toaster = ToastNotifier()
try:print("Title of reminder")header = input()print("Message of reminder")text = input()print("In how many minutes?")time_min = input()time_min=float(time_min)
except:header = input("Title of reminder\n")text = input("Message of remindar\n")time_min=float(input("In how many minutes?\n"))
time_min = time_min * 60
print("Setting up reminder..")
time.sleep(2)
print("all set!")
time.sleep(time_min)
toaster.show_toast(f"{header}",
f"{text}",
duration=10,
threaded=True)
while toaster.notification_active(): time.sleep(0.005)     

⑰ 维基百科文章摘要

目的:使用一种简单的方法从用户提供的文章链接中生成摘要。

提示:你可以使用爬虫获取文章数据,通过提取生成摘要。

from bs4 import BeautifulSoup
import re
import requests
import heapq
from nltk.tokenize import sent_tokenize,word_tokenize
from nltk.corpus import stopwordsurl = str(input("Paste the url"\n"))
num = int(input("Enter the Number of Sentence you want in the summary"))
num = int(num)
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'}
#url = str(input("Paste the url......."))
res = requests.get(url,headers=headers)
summary = ""
soup = BeautifulSoup(res.text,'html.parser') 
content = soup.findAll("p")
for text in content:summary +=text.text 
def clean(text):text = re.sub(r"\[[0-9]*\]"," ",text)text = text.lower()text = re.sub(r'\s+'," ",text)text = re.sub(r","," ",text)return text
summary = clean(summary)print("Getting the data......\n")##Tokenixing
sent_tokens = sent_tokenize(summary)summary = re.sub(r"[^a-zA-z]"," ",summary)
word_tokens = word_tokenize(summary)
## Removing Stop wordsword_frequency = {}
stopwords =  set(stopwords.words("english"))for word in word_tokens:if word not in stopwords:if word not in word_frequency.keys():word_frequency[word]=1else:word_frequency[word] +=1
maximum_frequency = max(word_frequency.values())
print(maximum_frequency)          
for word in word_frequency.keys():word_frequency[word] = (word_frequency[word]/maximum_frequency)
print(word_frequency)
sentences_score = {}
for sentence in sent_tokens:for word in word_tokenize(sentence):if word in word_frequency.keys():if (len(sentence.split(" "))) <30:if sentence not in sentences_score.keys():sentences_score[sentence] = word_frequency[word]else:sentences_score[sentence] += word_frequency[word]print(max(sentences_score.values()))
def get_key(val): for key, value in sentences_score.items(): if val == value: return key 
key = get_key(max(sentences_score.values()))
print(key+"\n")
print(sentences_score)
summary = heapq.nlargest(num,sentences_score,key=sentences_score.get)
print(" ".join(summary))
summary = " ".join(summary)

⑱ 获取谷歌搜索结果

目的:创建一个脚本,可以根据查询条件从谷歌搜索获取数据。

from bs4 import BeautifulSoup 
import requestsheaders = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'}
def google(query):query = query.replace(" ","+")try:url = f'https://www.google.com/search?q={query}&oq={query}&aqs=chrome..69i57j46j69i59j35i39j0j46j0l2.4948j0j7&sourceid=chrome&ie=UTF-8'res = requests.get(url,headers=headers)soup = BeautifulSoup(res.text,'html.parser')except:print("Make sure you have a internet connection")try:try:ans = soup.select('.RqBzHd')[0].getText().strip()except:try:title=soup.select('.AZCkJd')[0].getText().strip()try:ans=soup.select('.e24Kjd')[0].getText().strip()except:ans=""ans=f'{title}\n{ans}'except:try:ans=soup.select('.hgKElc')[0].getText().strip()except:ans=soup.select('.kno-rdesc span')[0].getText().strip()except:ans = "can't find on google"return ansresult = google(str(input("Query\n")))
print(result)

获取结果如下。
结果

⑲ 货币换算器

目的:编写一个Python脚本,可以将一种货币转换为其他用户选择的货币。

提示:使用Python中的API,或者通过forex-python模块来获取实时的货币汇率。

安装:forex-python

from forex_python.converter import CurrencyRatesc = CurrencyRates(
amount = int(input("Enter The Amount You Want To Convert\n"))from_currency = input( "Fromin").upper(o
to_currency = input("Toln-).upper(o
print( from_currency,"To",to_currency , amount)
result = c.convert(from_currency, to_currency, amount)print(result)

⑳ 键盘记录器

目的:编写一个Python脚本,将用户按下的所有键保存在一个文本文件中。

提示:pynput是Python中的一个库,用于控制键盘和鼠标的移动,它也可以用于制作键盘记录器。简单地读取用户按下的键,并在一定数量的键后将它们保存在一个文本文件中。

from pynput.keyboard import Key, Controller,Listener
import time
keyboard = Controller()keys=[]
def on_press(key):global keys#keys.append(str(key).replace("'",""))string = str(key).replace("'","")keys.append(string)main_string = "".join(keys)print(main_string)if len(main_string)>15:with open('keys.txt', 'a') as f:f.write(main_string)   keys= []     
def on_release(key):if key == Key.esc:return Falsewith listener(on_press=on_press,on_release=on_release) as listener:listener.join()

㉑ 文章朗读器

目的:编写一个Python脚本,自动从提供的链接读取文章。

import pyttsx3
import requests
from bs4 import BeautifulSoup
url = str(input("Paste article url\n"))def content(url):res = requests.get(url)soup = BeautifulSoup(res.text,'html.parser')articles = []for i in range(len(soup.select('.p'))):article = soup.select('.p')[i].getText().strip()articles.append(article)contents = " ".join(articles)return contents
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[0].id)def speak(audio):engine.say(audio)engine.runAndWait()contents = content(url)
## print(contents)      ## In case you want to see the content#engine.save_to_file
#engine.runAndWait() ## In case if you want to save the article as a audio file

㉒ 短网址生成器

目的:编写一个Python脚本,使用API缩短给定的URL。

from __future__ import with_statement
import contextlib
try:from urllib.parse import urlencode
except ImportError:from urllib import urlencode
try:from urllib.request import urlopen
except ImportError:from urllib2 import urlopen
import sysdef make_tiny(url):request_url = ('http://tinyurl.com/api-create.php?' + urlencode({'url':url}))with contextlib.closing(urlopen(request_url)) as response:return response.read().decode('utf-8')def main():for tinyurl in map(make_tiny, sys.argv[1:]):print(tinyurl)if __name__ == '__main__':main()
-----------------------------OUTPUT------------------------

以上就是今天分享的内容,针对上面这些项目,有的可以适当调整。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/19742.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

变透明的黑匣子:UCLA 开发可解释神经网络 SNN 预测山体滑坡

内容一览&#xff1a;由于涉及到多种时空变化因素&#xff0c;山体滑坡预测一直以来都非常困难。深度神经网络 (DNN) 可以提高预测准确性&#xff0c;但其本身并不具备可解释性。本文中&#xff0c;UCLA 研究人员引入了 SNN。SNN 具有完全可解释性、高准确性、高泛化能力和低模…

vue3+ts+pinia整合websocket

文章目录 一. 目标二. 前置环境三. websocket通用模板 一. 目标 先有实时数据需要展示. 由于设备量极大且要对设备参数实时记录展示.axios空轮询不太适合. 选择websocket长连接通讯. 使用pinia原因是pinia具备共享数据性质.可以作为消息队列缓存数据,降低渲染压力.同时方便多…

一元三次方程求解

一元三次方程求解 题目描述提示输入输出格式输入格式输出格式 输入输出样例输入样例输出样例 算法分析A C 代码 题目描述 有形如&#xff1a; a x 3 b x 2 c x d 0 ax^3bx^2c^xd0 ax3bx2cxd0一元三次方程。给出该方程中各项的系数 ( a a a&#xff0c; b b b&#xff0c;…

P2141 [NOIP2014 普及组] 珠心算测验

题目背景 NOIP2014 普及 T1 题目描述 珠心算是一种通过在脑中模拟算盘变化来完成快速运算的一种计算技术。珠心算训练&#xff0c;既能够开发智力&#xff0c;又能够为日常生活带来很多便利&#xff0c;因而在很多学校得到普及。 某学校的珠心算老师采用一种快速考察珠心算…

无限遍历,Python实现在多维嵌套字典、列表、元组的JSON中获取数据

目录 背景 思路 新建两个函数A和B&#xff0c;函数 A处理字典数据&#xff0c;被调用后&#xff0c;判断传递的参数&#xff0c;如果参数为字典&#xff0c;则调用自身&#xff1b; 如果是列表或者元组&#xff0c;则调用列表处理函数B&#xff1b; 函数 B处理列表&#x…

TabR:检索增强能否让深度学习在表格数据上超过梯度增强模型?

这是一篇7月新发布的论文&#xff0c;他提出了使用自然语言处理的检索增强Retrieval Augmented技术&#xff0c;目的是让深度学习在表格数据上超过梯度增强模型。 检索增强一直是NLP中研究的一个方向&#xff0c;但是引入了检索增强的表格深度学习模型在当前实现与非基于检索的…

MySQL的使用——【初识MySQL】第二节

MySQL的使用——【初识MySQL】第二节 文章目录 MySQL环境变量的配置&#xff08;如使用Navicat可忽略&#xff09;使用命令行连接MySQL&#xff08;如使用Navicat可忽略&#xff09;步骤注意 NavicatNavicat的下载Navicat的使用连接MySQL新建表 总结总结 MySQL环境变量的配置&a…

SpringCloudAlibaba之Nacos服务的发现与注册中心(二)配置

在nacos中的雪崩保护 和阈值&#xff08;0~1&#xff09;与spring.cloud.nacos.discovery.ephemeral这个配置有关 ephemeral为false&#xff0c;永久实例 epheme为true&#xff0c;临时实例&#xff08;默认&#xff09; 健康实例数/总实例数<保护阈值的时候&#xff0c;…

【秋招】算法岗的八股文之机器学习

目录 机器学习特征工程常见的计算模型总览线性回归模型与逻辑回归模型线性回归模型逻辑回归模型区别 朴素贝叶斯分类器模型 (Naive Bayes)决策树模型随机森林模型支持向量机模型 (Support Vector Machine)K近邻模型神经网络模型卷积神经网络&#xff08;CNN&#xff09;循环神经…

Redis中缓存穿透、击穿、雪崩以及解决方案

Redis中缓存穿透、击穿、雪崩以及解决方案 Redis作为一个高效的内存数据库&#xff0c;提供了缓存能力使得我们能够快速访问数据。然而&#xff0c;在使用Redis作为缓存时&#xff0c;我们可能会面临缓存穿透、缓存击穿和缓存雪崩的问题。接下来&#xff0c;我将详细解释这些现…

【雕爷学编程】MicroPython动手做(28)——物联网之Yeelight 3

知识点&#xff1a;什么是掌控板&#xff1f; 掌控板是一块普及STEAM创客教育、人工智能教育、机器人编程教育的开源智能硬件。它集成ESP-32高性能双核芯片&#xff0c;支持WiFi和蓝牙双模通信&#xff0c;可作为物联网节点&#xff0c;实现物联网应用。同时掌控板上集成了OLED…

Stable Diffusion:网页版 体验 / AI 绘图

一、官网地址 Stable Diffusion Online 二、Stable Diffusion AI 能做什么 Stable Diffusion AI绘图是一种基于Stable Diffusion模型的生成式AI技术&#xff0c;能够生成各种类型的图像&#xff0c;包括数字艺术、照片增强和图像修复等。以下是一些可能的应用&#xff1a; …

AX7A200教程(8): HDMI输入和输出显示1080p视频

文章目录 本章节主要将hdmi输入的1080p视频通过ddr3缓存&#xff0c;然后通过hdmi输出口输出到显示屏上显示 一&#xff0c; 突发读写命令 设置读写突发长度为64 //parameter defineparameter WRITE_LENGTH 64;parameter READ_LENGTH 64;parameter IDLE 3d0; …

C#实现结构体与字节流的相互转化

unity项目中&#xff0c;涉及到与C的相互通信&#xff0c;而通信接口为C封好的动态库。所以&#xff0c;传输信息时&#xff0c;需要向C端发送字节流信息。 对此&#xff0c;需将结构体数据转为字节流&#xff0c;其代码如下&#xff1a; public static byte[] StructToBytes(…

如何用DHTMLX组件为Web应用创建甘特图?(二)

dhtmlxGantt是用于跨浏览器和跨平台应用程序的功能齐全的Gantt图表。可满足项目管理应用程序的所有需求&#xff0c;是最完善的甘特图图表库。甘特图仍然是项目管理应用程序中最需要的工具之一&#xff0c;DHTMLX Gantt组件提供了能提升研发甘特图功能所需的重要工具。 在这篇…

Kotlin基础(十):函数进阶

前言 本文主要讲解kotlin函数&#xff0c;之前系列文章中提到过函数&#xff0c;本文是kotlin函数的进阶内容。 Kotlin文章列表 Kotlin文章列表: 点击此处跳转查看 目录 1.1 函数基本用法 Kotlin 是一种现代的静态类型编程语言&#xff0c;它在函数的定义和使用上有一些特点…

什么是互斥锁?怎么运用互斥锁?

1、什么是互斥锁&#xff1f; 互斥锁是&#xff08;Mutex&#xff09;是一种用于多线程编程的同步原语&#xff0c;用于确保在多个线程访问共享资源时的互斥性。 在多线程环境中&#xff0c;当多个线程同时访问共享资源时&#xff0c;可能会导致数据的竞争和不一致问题。为了…

国家之间的标准的语言代码

当涉及到标准的语言代码时&#xff0c;以下是一些常见的国家/地区与其对应的语言代码&#xff1a; 美国英语&#xff1a;en-US英国英语&#xff1a;en-GB加拿大英语&#xff1a;en-CA澳大利亚英语&#xff1a;en-AU法国法语&#xff1a;fr-FR德国德语&#xff1a;de-DE中国普通…

改造 ChatGPT-Next-Web 项目重新生成 Docker 镜像

改造 ChatGPT-Next-Web 项目重新生成 Docker 镜像 0.背景1. 修改代码2. 生成 Docker 镜像3. 上传 Docker 镜像4. 运行 Docker 镜像 0.背景 需要通过 ChatGPT-Next-Web 使用自己搭建的 OpenAI API 兼容的服务器&#xff0c;需要对 ChatGPT-Next-Web 项目的少量代码进行改造。 …

无人机自动返航的关键技术有哪些

无人机的广泛应用使得无人机自动返航技术变得至关重要。在各种应对意外情况的背景下&#xff0c;无人机自动返航技术的发展对确保无人机的安全&#xff0c;以及提高其应用范围具有重要意义。接下来&#xff0c;便为大家详细介绍无人机自动返航所运用到的关键技术。 一、定位与导…