python可以制作回合制游戏么_尝试为回合制游戏创建重播功能(非常新手)

这将查看文件夹中的匹配项,并获取文件夹的最小编号。在folder = os.path.join('C:\\Users\\Felipe\\', 'Desktop') # Folder in which the images are in.

recorded_matches_location = 'D:\\Hearthstone\\Replays\\'

match_number = 1

match_name = 'match1'

while match_name in os.listdir(recorded_matches_location):

match_number = 1 + match_number

match_name = 'match' + str(match_number) # corrected it! there must be a string and not a variable

destination = os.path.join(recorded_matches_location, match_name) #**Destination needs to be the newest folder and I dont know how to implement that...

extmove = 'png' # The extension you wish to organize.

num = 0 # Variable simply to use after to count images.

for filename in os.listdir(folder): #Run through folder.

extension = filename.split(".")[-1] # This strips the extensions ready to check and places into the extension

if extension == extmove: # If statement. If the extension of the file matches the one set previously then..

shutil.move(folder + "\\" + filename, destination) # Move the file from the folder to the destination folder. Also previously set.

num = num + 1

print(num)

print (filename, extension)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值