unote 書けば書くほどに

20230409

import openpyxl as px
import os
import glob

# ワイルドカードでファイルを指定
files1 = glob.glob("C:/test/wb1/*.xlsx")
files2 = glob.glob("C:/test/wb2/*.xlsx")

# ファイル名を変更
for file in files1:
new_filename = os.path.join(os.path.dirname(file), "wb1.xlsx")
os.rename(file, new_filename)

for file in files2:
new_filename = os.path.join(os.path.dirname(file), "wb2.xlsx")
os.rename(file, new_filename)

A列とB列が両方とも空白でない場合は、組み合わせて出
if master_code is not None and master_code is not None:
if product_code == master_code:

@echo off

echo #### wb1 check
set FOLDER1=C:\wb1

if exist "%FOLDER1%" (
echo wb1フォルダーは作成済です
) else (
md c:\wb1
)
echo #### wb2 check

set FOLDER2=C:\wb2

if exist "%FOLDER2%" (
echo wb2フォルダーは作成済です
) else (
md c:\wb2
)

pause

■RESTART
import os

restart = input("restart?(y/n): ")

if restart == 'n':
exit()
else:
os.system("shutdown /r /t 1")

# https://laboratory.kazuuu.net/restart-your-computer-using-python/
# https://camp.trainocate.co.jp/magazine/pyinstaller-python-exe/


Pythonスクリプトをexe化する | Python学習講座