欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Python3利用Qt5實(shí)現(xiàn)簡易的五子棋游戲

 更新時間:2022年05月02日 11:45:23   作者:WXjzcccc  
這篇文章主要為大家詳細(xì)介紹了Python3利用Qt5實(shí)現(xiàn)簡易的五子棋游戲,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下

要寫出一個五子棋游戲,我們最先要解決的,就是如何下子,如何判斷已經(jīng)五子連珠,而不是如何繪制畫面,因此我們先確定棋盤

五子棋采用15*15的棋盤,因此,我們可以使用二維列表來創(chuàng)建一個棋盤,不妨認(rèn)為0表示未放置棋子,1表示放置白子,2表示放置黑子。

顯而易見可以創(chuàng)建列表,注意不能使用*來復(fù)制列表

self.chess_board = [[0 for i in range(15)] for i in range(15)]

下棋的步驟十分好做,只需要找到對應(yīng)的索引進(jìn)行賦值即可,下一步應(yīng)該解決如何判斷五子連珠的問題。

每當(dāng)我們落子結(jié)束后,應(yīng)該判斷是否已經(jīng)完成五子連珠。對于剛放置的一顆棋子而言,可能的情況大致分為四種:

1.水平
2.斜向右下
3.豎直
4.斜向右上

要判斷是否已經(jīng)連珠成功,我們以剛放置的棋子為起點(diǎn),先向前遍歷4個棋子,并計算相同棋子的個數(shù),一旦遇到不同的棋子,就停止,然后從起點(diǎn)向后遍歷4個棋子,直到全部遍歷完成或者棋子總數(shù)已經(jīng)達(dá)到5個,就可以返回。我們只需要注意如何獲得棋子的前后棋子以及棋盤的邊界問題,棋子不可能超出棋盤,因此被遍歷的棋子也不能超出棋盤。

以水平為例,可以得到代碼

def judge_1(self,x:int,y:int) -> bool:
? ? ? ? count = 1
? ? ? ? if self.chess_board[x][y] != 0:
? ? ? ? ? ? for i in range(1,5):
? ? ? ? ? ? ? ? if y - i >= 0:
? ? ? ? ? ? ? ? ? ? if self.chess_board[x][y] == self.chess_board[x][y-i]:
? ? ? ? ? ? ? ? ? ? ? ? print(x,y-i)
? ? ? ? ? ? ? ? ? ? ? ? count += 1
? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? break
? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? break
? ? ? ? ? ? for i in range(1,5):
? ? ? ? ? ? ? ? if y + i <=14:
? ? ? ? ? ? ? ? ? ? if self.chess_board[x][y] == self.chess_board[x][y+i]:
? ? ? ? ? ? ? ? ? ? ? ? print(x,y+i)
? ? ? ? ? ? ? ? ? ? ? ? count += 1
? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? break
? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? break
? ? ? ? if count == 5:
? ? ? ? ? ? return True
? ? ? ? return False

以相似的步驟完成其余三種判斷,就已經(jīng)完成了五子棋游戲的核心要素了,剩下的就需要交給PyQt5來完成游戲的繪制來完善游戲了。

我們創(chuàng)建一個類來繼承QWidget類,創(chuàng)建一個窗口,之后我們需要創(chuàng)建幾個屬性來完成儲存我們的數(shù)據(jù)信息

#棋子的坐標(biāo)
self.x = -1
self.y = -1
#區(qū)分玩家
#開始標(biāo)簽
self.flag = False
#儲存已經(jīng)下好的白子
self.white_chess = []
#儲存已經(jīng)下好的黑子
self.black_chess = []

我們已經(jīng)可以開始繪制棋盤,在Qt5中,如果我們需要進(jìn)行繪制,我們應(yīng)該重寫paintEvent方法,這個方法會由程序自動調(diào)用執(zhí)行。創(chuàng)建一個QPainter對象,將需要繪制的內(nèi)容用begin與end方法包裹起來,就可以完成繪制。

我們用drawLine方法來繪制線條,用drawEllipse方法來繪制棋子,使用setPen來更改線條樣式,setBrush來更改棋子樣式。

得到代碼(本段代碼有參考他人代碼,這是我第一次接觸Qt的繪制)

--------------------GUI中的x軸豎直向下,y軸水平向右,因此繪制棋子時的x與y需要顛倒---------------

#繪制棋盤與棋子
? ? def paintEvent(self, e) -> None:
? ? ? ? qp = QPainter()
? ? ? ? qp.begin(self)
? ? ? ? qp.fillRect(self.rect(), QColor("light blue"))
? ? ? ? qp.drawRect(self.rect())
? ? ? ? qp.setBackground(QColor("yellow"))
? ? ? ? qp.setPen(QPen(QColor(0, 0, 0), 2, Qt.SolidLine))
? ? ? ? for i in range(15):
? ? ? ? ? ? qp.drawLine(QPoint(30, 30 + 30 * i), QPoint(450, 30 + 30 * i))
? ? ? ? for i in range(15):
? ? ? ? ? ? qp.drawLine(QPoint(30 + 30 * i, 30), QPoint(30 + 30 * i, 450))
? ? ? ? qp.setBrush(QColor(0, 0, 0))
? ? ? ? key_points = [(3, 3), (11, 3), (3, 11), (11, 11), (7, 7)]
? ? ? ? if len(self.black_chess) != 0:
? ? ? ? ? ? for t in self.black_chess:
? ? ? ? ? ? ? ? #畫黑子
? ? ? ? ? ? ? ? qp.drawEllipse(QPoint(30 + 30 * t[1], 30 + 30 * t[0]), 6, 6)
? ? ? ? for t in key_points:
? ? ? ? ? ? #棋盤的5個定點(diǎn)
? ? ? ? ? ? qp.drawEllipse(QPoint(30 + 30 * t[0], 30 + 30 * t[1]), 3, 3)
? ? ? ? qp.setBrush(QColor(255,255,255))
? ? ? ? if len(self.white_chess) != 0:
? ? ? ? ? ? for t in self.white_chess:
? ? ? ? ? ? ? ? #畫白子
? ? ? ? ? ? ? ? qp.drawEllipse(QPoint(30 + 30 * t[1], 30 + 30 * t[0]), 6, 6)
? ? ? ? qp.end()

另一個需要在GUI中解決的問題就是,如何獲取要下的棋子的坐標(biāo)?我們可以通過重寫鼠標(biāo)事件來解決,重寫單機(jī)事件mousePressEvent,并修改棋子的x坐標(biāo)與y坐標(biāo)即可,另外,用戶不可能每次都恰巧點(diǎn)到我們規(guī)定的坐標(biāo)點(diǎn)上,因此需要給出一個大致范圍判斷,這里我的方式是先獲取坐標(biāo),然后根據(jù)坐標(biāo)找到距離最近的點(diǎn)

def mousePressEvent(self, e) -> None:
? ? ? ? if e.buttons() == QtCore.Qt.LeftButton:
? ? ? ? ? ? if e.x() > 15 and e.x() < 465 and e.y() > 15 and e.y() < 465:
? ? ? ? ? ? ? ? x = e.x()/30 - e.x()//30
? ? ? ? ? ? ? ? y = e.y()/30 - e.y()//30
? ? ? ? ? ? ? ? self.y = (e.x()-30)//30 if x < 0.5 else (e.x()-30)//30 + 1
? ? ? ? ? ? ? ? self.x = (e.y()-30)//30 if y < 0.5 else (e.y()-30)//30 + 1
? ? ? ? ? ? ? ? if self.flag:
? ? ? ? ? ? ? ? ? ? print(self.x,self.y)
? ? ? ? ? ? ? ? ? ? if self.player % 2 == 1:
? ? ? ? ? ? ? ? ? ? ? ? if goBang.put_white_chess(self.x,self.y):
? ? ? ? ? ? ? ? ? ? ? ? ? ? self.player += 1?
? ? ? ? ? ? ? ? ? ? ? ? ? ? print('黑子行動')
? ? ? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? ? ? print('白子行動')
? ? ? ? ? ? ? ? ? ? ? ? if goBang.judge(self.x,self.y):
? ? ? ? ? ? ? ? ? ? ? ? ? ? msg_box = QMessageBox(QMessageBox.Information, '提示', '白子獲勝!')
? ? ? ? ? ? ? ? ? ? ? ? ? ? msg_box.exec_()
? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? if goBang.put_black_chess(self.x,self.y):
? ? ? ? ? ? ? ? ? ? ? ? ? ? self.player += 1
? ? ? ? ? ? ? ? ? ? ? ? ? ? print('白子行動')
? ? ? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? ? ? print('黑子行動')
? ? ? ? ? ? ? ? ? ? ? ? if goBang.judge(self.x,self.y):
? ? ? ? ? ? ? ? ? ? ? ? ? ? msg_box = QMessageBox(QMessageBox.Information, '提示', '黑子獲勝!')
? ? ? ? ? ? ? ? ? ? ? ? ? ? msg_box.exec_()

每當(dāng)游戲完成,我們應(yīng)該可以清空棋盤,也就是將所有儲存數(shù)據(jù)的變量都重新初始化再重繪棋盤

#清除棋盤,重開游戲
? ? def clear(self) -> None:
? ? ? ? self.x = -1
? ? ? ? self.y = -1
? ? ? ? self.player = 0
? ? ? ? self.flag = False
? ? ? ? self.white_chess = []
? ? ? ? self.black_chess = []
? ? ? ? self.chess_board = [[0 for i in range(15)] for i in range(15)]
? ? ? ? self.update()

這樣就大致結(jié)束了??!

下面是全部代碼:

from PyQt5 import *
from PyQt5 import QtCore
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
import sys
?
class GoBang(QWidget):
? ? #初始化棋盤
? ? def __init__(self):
? ? ? ? super().__init__()
? ? ? ? self.setWindowTitle('五子棋Hi~ o(* ̄▽ ̄*)ブ')
? ? ? ? self.x = -1
? ? ? ? self.y = -1
? ? ? ? #區(qū)分玩家
? ? ? ? self.player = 0
? ? ? ? #開始標(biāo)簽
? ? ? ? self.flag = False
? ? ? ? #儲存已經(jīng)下好的白子
? ? ? ? self.white_chess = []
? ? ? ? #儲存已經(jīng)下好的黑子
? ? ? ? self.black_chess = []
? ? ? ? self.setFixedSize(800,600)
? ? ? ? self.chess_board = [[0 for i in range(15)] for i in range(15)]
? ? ? ? btn1 = QPushButton('開始',self)
? ? ? ? btn1.setGeometry(500,100,50,30)
? ? ? ? btn1.clicked.connect(self.setFlag)
? ? ? ? btn2 = QPushButton('重開',self)
? ? ? ? btn2.setGeometry(550,100,50,30)
? ? ? ? btn2.clicked.connect(self.clear)
? ? ? ? self.show()
? ??
? ? #繪制棋盤與棋子
? ? def paintEvent(self, e) -> None:
? ? ? ? qp = QPainter()
? ? ? ? qp.begin(self)
? ? ? ? qp.fillRect(self.rect(), QColor("light blue"))
? ? ? ? qp.drawRect(self.rect())
? ? ? ? qp.setBackground(QColor("yellow"))
? ? ? ? qp.setPen(QPen(QColor(0, 0, 0), 2, Qt.SolidLine))
? ? ? ? for i in range(15):
? ? ? ? ? ? qp.drawLine(QPoint(30, 30 + 30 * i), QPoint(450, 30 + 30 * i))
? ? ? ? for i in range(15):
? ? ? ? ? ? qp.drawLine(QPoint(30 + 30 * i, 30), QPoint(30 + 30 * i, 450))
? ? ? ? qp.setBrush(QColor(0, 0, 0))
? ? ? ? key_points = [(3, 3), (11, 3), (3, 11), (11, 11), (7, 7)]
? ? ? ? if len(self.black_chess) != 0:
? ? ? ? ? ? for t in self.black_chess:
? ? ? ? ? ? ? ? #畫黑子
? ? ? ? ? ? ? ? qp.drawEllipse(QPoint(30 + 30 * t[1], 30 + 30 * t[0]), 6, 6)
? ? ? ? for t in key_points:
? ? ? ? ? ? #棋盤的5個定點(diǎn)
? ? ? ? ? ? qp.drawEllipse(QPoint(30 + 30 * t[0], 30 + 30 * t[1]), 3, 3)
? ? ? ? qp.setBrush(QColor(255,255,255))
? ? ? ? if len(self.white_chess) != 0:
? ? ? ? ? ? for t in self.white_chess:
? ? ? ? ? ? ? ? #畫白子
? ? ? ? ? ? ? ? qp.drawEllipse(QPoint(30 + 30 * t[1], 30 + 30 * t[0]), 6, 6)
? ? ? ? qp.end()
?
? ? #更改標(biāo)簽,開始游戲
? ? def setFlag(self) -> None:
? ? ? ? self.flag = True
?
? ? def mousePressEvent(self, e) -> None:
? ? ? ? if e.buttons() == QtCore.Qt.LeftButton:
? ? ? ? ? ? if e.x() > 15 and e.x() < 465 and e.y() > 15 and e.y() < 465:
? ? ? ? ? ? ? ? x = e.x()/30 - e.x()//30
? ? ? ? ? ? ? ? y = e.y()/30 - e.y()//30
? ? ? ? ? ? ? ? self.y = (e.x()-30)//30 if x < 0.5 else (e.x()-30)//30 + 1
? ? ? ? ? ? ? ? self.x = (e.y()-30)//30 if y < 0.5 else (e.y()-30)//30 + 1
? ? ? ? ? ? ? ? if self.flag:
? ? ? ? ? ? ? ? ? ? print(self.x,self.y)
? ? ? ? ? ? ? ? ? ? if self.player % 2 == 1:
? ? ? ? ? ? ? ? ? ? ? ? if goBang.put_white_chess(self.x,self.y):
? ? ? ? ? ? ? ? ? ? ? ? ? ? self.player += 1?
? ? ? ? ? ? ? ? ? ? ? ? ? ? print('黑子行動')
? ? ? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? ? ? print('白子行動')
? ? ? ? ? ? ? ? ? ? ? ? if goBang.judge(self.x,self.y):
? ? ? ? ? ? ? ? ? ? ? ? ? ? msg_box = QMessageBox(QMessageBox.Information, '提示', '白子獲勝!')
? ? ? ? ? ? ? ? ? ? ? ? ? ? msg_box.exec_()
? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? if goBang.put_black_chess(self.x,self.y):
? ? ? ? ? ? ? ? ? ? ? ? ? ? self.player += 1
? ? ? ? ? ? ? ? ? ? ? ? ? ? print('白子行動')
? ? ? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? ? ? print('黑子行動')
? ? ? ? ? ? ? ? ? ? ? ? if goBang.judge(self.x,self.y):
? ? ? ? ? ? ? ? ? ? ? ? ? ? msg_box = QMessageBox(QMessageBox.Information, '提示', '黑子獲勝!')
? ? ? ? ? ? ? ? ? ? ? ? ? ? msg_box.exec_()
?
? ? ? ? ? ??
? ? #下白子
? ? def put_white_chess(self,x:int,y:int) -> bool:
? ? ? ? if self.chess_board[x][y] != 0:
? ? ? ? ? ? msg_box = QMessageBox(QMessageBox.Information, '提示', '這個位置已經(jīng)有棋子了!')
? ? ? ? ? ? msg_box.exec_()
? ? ? ? ? ? return False
? ? ? ? else:
? ? ? ? ? ? self.chess_board[x][y] = 1
? ? ? ? ? ? self.white_chess.append((x,y))
? ? ? ? ? ? self.update()
? ? ? ? ? ? return True
?
? ? #下黑子
? ? def put_black_chess(self,x:int,y:int) -> bool:
? ? ? ? if self.chess_board[x][y] != 0:
? ? ? ? ? ? msg_box = QMessageBox(QMessageBox.Information, '提示', '這個位置已經(jīng)有棋子了!')
? ? ? ? ? ? msg_box.exec_()
? ? ? ? ? ? return False
? ? ? ? else:
? ? ? ? ? ? self.chess_board[x][y] = 2
? ? ? ? ? ? self.black_chess.append((x,y))
? ? ? ? ? ? self.update()
? ? ? ? ? ? return True
?
? ? #清除棋盤,重開游戲
? ? def clear(self) -> None:
? ? ? ? self.x = -1
? ? ? ? self.y = -1
? ? ? ? self.player = 0
? ? ? ? self.flag = False
? ? ? ? self.white_chess = []
? ? ? ? self.black_chess = []
? ? ? ? self.chess_board = [[0 for i in range(15)] for i in range(15)]
? ? ? ? self.update()
?
? ? #判斷是否已經(jīng)五子連珠
? ? def judge(self,x:int,y:int) -> bool:
? ? ? ? if self.judge_1(x,y) or self.judge_2(x,y) or self.judge_3(x,y) or self.judge_4(x,y):
? ? ? ? ? ? return True
? ? ? ? return False
?
? ? #判斷橫線
? ? def judge_1(self,x:int,y:int) -> bool:
? ? ? ? count = 1
? ? ? ? if self.chess_board[x][y] != 0:
? ? ? ? ? ? for i in range(1,5):
? ? ? ? ? ? ? ? if y - i >= 0:
? ? ? ? ? ? ? ? ? ? if self.chess_board[x][y] == self.chess_board[x][y-i]:
? ? ? ? ? ? ? ? ? ? ? ? print(x,y-i)
? ? ? ? ? ? ? ? ? ? ? ? count += 1
? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? break
? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? break
? ? ? ? ? ? for i in range(1,5):
? ? ? ? ? ? ? ? if y + i <=14:
? ? ? ? ? ? ? ? ? ? if self.chess_board[x][y] == self.chess_board[x][y+i]:
? ? ? ? ? ? ? ? ? ? ? ? print(x,y+i)
? ? ? ? ? ? ? ? ? ? ? ? count += 1
? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? break
? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? break
? ? ? ? if count == 5:
? ? ? ? ? ? return True
? ? ? ? return False
?
? ? #判斷右下線
? ? def judge_2(self,x:int,y:int) -> bool:
? ? ? ? count = 1
? ? ? ? if self.chess_board[x][y] != 0:
? ? ? ? ? ? for i in range(1,5):
? ? ? ? ? ? ? ? if x-i >= 0 and y - i >= 0:
? ? ? ? ? ? ? ? ? ? if self.chess_board[x][y] == self.chess_board[x-i][y-i]:
? ? ? ? ? ? ? ? ? ? ? ? print(x-i,y-i)
? ? ? ? ? ? ? ? ? ? ? ? count += 1
? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? break
? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? break
? ? ? ? ? ? for i in range(1,5):
? ? ? ? ? ? ? ? if x + i <= 14 and y + i <= 14:
? ? ? ? ? ? ? ? ? ? if self.chess_board[x][y] == self.chess_board[x+i][y+i]:
? ? ? ? ? ? ? ? ? ? ? ? print(x+i,y+i)
? ? ? ? ? ? ? ? ? ? ? ? count += 1
? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? break
? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? break
? ? ? ? if count == 5:
? ? ? ? ? ? return True
? ? ? ? return False
?
? ? #判斷豎線
? ? def judge_3(self,x:int,y:int) -> bool:
? ? ? ? count = 1
? ? ? ? if self.chess_board[x][y] != 0:
? ? ? ? ? ? for i in range(1,5):
? ? ? ? ? ? ? ? if x - i >= 0:
? ? ? ? ? ? ? ? ? ? if self.chess_board[x][y] == self.chess_board[x-i][y]:
? ? ? ? ? ? ? ? ? ? ? ? print(x-i,y)
? ? ? ? ? ? ? ? ? ? ? ? count += 1
? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? break
? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? break
? ? ? ? ? ? for i in range(1,5):
? ? ? ? ? ? ? ? if x + i <= 14:
? ? ? ? ? ? ? ? ? ? if self.chess_board[x][y] == self.chess_board[x+i][y]:
? ? ? ? ? ? ? ? ? ? ? ? print(x+i,y)
? ? ? ? ? ? ? ? ? ? ? ? count += 1
? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? break
? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? break
? ? ? ? if count == 5:
? ? ? ? ? ? return True
? ? ? ? return False
?
? ? #判斷右上線
? ? def judge_4(self,x:int,y:int) -> bool:
? ? ? ? count = 1
? ? ? ? if self.chess_board[x][y] != 0:
? ? ? ? ? ? for i in range(1,5):
? ? ? ? ? ? ? ? if x - i >= 0 and y + i <= 14:
? ? ? ? ? ? ? ? ? ? if self.chess_board[x][y] == self.chess_board[x-i][y+i]:
? ? ? ? ? ? ? ? ? ? ? ? print(x-i,y+i)
? ? ? ? ? ? ? ? ? ? ? ? count += 1
? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? break
? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? break
? ? ? ? ? ? for i in range(1,5):
? ? ? ? ? ? ? ? if x + i <= 14 and y - i >= 0:
? ? ? ? ? ? ? ? ? ? if self.chess_board[x][y] == self.chess_board[x+i][y-i]:
? ? ? ? ? ? ? ? ? ? ? ? print(x+i,y-i)
? ? ? ? ? ? ? ? ? ? ? ? count += 1
? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? break
? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? break
? ? ? ? if count == 5:
? ? ? ? ? ? return True
? ? ? ? return False
?
#程序入口
if __name__ == '__main__': ?
? ? app = QApplication(sys.argv) ?
? ? goBang = GoBang()
? ? sys.exit(app.exec_())

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • Python 編碼規(guī)范(Google Python Style Guide)

    Python 編碼規(guī)范(Google Python Style Guide)

    本項目并非 Google 官方項目, 而是由國內(nèi)程序員憑熱情創(chuàng)建和維護(hù),對于想學(xué)習(xí)python的朋友可以參考一下
    2018-05-05
  • python之value_counts()的具體使用

    python之value_counts()的具體使用

    value_counts()?是一個用于統(tǒng)計某列中各個值的出現(xiàn)次數(shù)的函數(shù),本文主要介紹了python之value_counts()的具體使用,具有一定的參考價值,感興趣的可以了解一下
    2023-10-10
  • python 用遞歸實(shí)現(xiàn)通用爬蟲解析器

    python 用遞歸實(shí)現(xiàn)通用爬蟲解析器

    這篇文章主要介紹了python 用遞歸實(shí)現(xiàn)通用爬蟲解析器的方法,幫助大家更好的理解和學(xué)習(xí)使用python,感興趣的朋友可以了解下
    2021-04-04
  • python二分查找搜索算法的多種實(shí)現(xiàn)方法

    python二分查找搜索算法的多種實(shí)現(xiàn)方法

    二分查找,也稱折半查找,是一種效率較高的查找方法,本文主要介紹了python二分查找搜索算法的多種實(shí)現(xiàn)方法,具有一定的參考價值,感興趣的可以了解一下
    2024-03-03
  • python應(yīng)用文件讀取與登錄注冊功能

    python應(yīng)用文件讀取與登錄注冊功能

    這篇文章主要介紹了python應(yīng)用文件讀取寫登錄注冊功能,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),具有一定的參考借鑒價值,需要的朋友可以參考下
    2019-09-09
  • Python的缺點(diǎn)和劣勢分析

    Python的缺點(diǎn)和劣勢分析

    在本篇文章里小編給大家整理了關(guān)于Python的缺點(diǎn)和劣勢總結(jié),有興趣的朋友們可以學(xué)習(xí)下。
    2019-11-11
  • Python?VisPy庫高性能科學(xué)可視化圖形處理用法實(shí)例探究

    Python?VisPy庫高性能科學(xué)可視化圖形處理用法實(shí)例探究

    VisPy是一個用于高性能科學(xué)可視化的Python庫,它建立在現(xiàn)代圖形處理單元(GPU)上,旨在提供流暢、交互式的數(shù)據(jù)可視化體驗,本文將深入探討VisPy的基本概念、核心特性以及實(shí)際應(yīng)用場景,并通過豐富的示例代碼演示其強(qiáng)大的可視化能力
    2023-12-12
  • 利用python實(shí)現(xiàn)你說我猜游戲的完整實(shí)例

    利用python實(shí)現(xiàn)你說我猜游戲的完整實(shí)例

    這篇文章主要給大家介紹了關(guān)于如何利用python實(shí)現(xiàn)你說我猜游戲的相關(guān)資料,用到的都是一些簡單的基礎(chǔ)的python語句,適合剛?cè)腴T的小白,可以嘗試跟著一起敲一下,感受一下編程中的樂趣,需要的朋友可以參考下
    2022-05-05
  • python對ip地址進(jìn)行排序、分類的方法詳解

    python對ip地址進(jìn)行排序、分類的方法詳解

    這篇文章主要介紹了python對ip地址進(jìn)行排序、分類的方法詳解,IP協(xié)議全稱為“網(wǎng)際互連協(xié)議Internet?Protocol”,IP協(xié)議是TCP/IP體系中的網(wǎng)絡(luò)層協(xié)議,需要的朋友可以參考下
    2023-07-07
  • Python爬蟲之requests庫基本介紹

    Python爬蟲之requests庫基本介紹

    大家好,本篇文章主要講的是Python爬蟲之requests庫基本介紹,感興趣的同學(xué)趕快來看一看吧,對你有幫助的話記得收藏一下
    2022-02-02

最新評論