最近遇到一個問題,想要對四個不同的PDF,分別擷取1~2頁、3~4頁、5~6頁、7~8頁,合併成一個總共8頁的PDF。那該怎麼寫程式來處理這件事呢?那如果是用線上拆分PDF網頁與線上合併PDF網頁,該怎麼做呢?則是需要將四個不同PDF分別上傳到拆分網頁後再一頁一頁的PDF下載下來,再將所需要頁數的PDF放在同一個資料夾,然後再上傳到合併網頁,最後下到自己的資料夾。不斷地上傳、下載。光是處理這些步驟,所花的時間根本就無法想像。能不能有個程式,會掃描input資料夾內檔案。匯出input資料夾內所有檔案名稱,我們只要設定起始頁面與最後頁面。再對程式點兩下,就會合併所有的頁面到一個PDF。換句話說,只要點兩下兩次,就能依照設定拆分指定PDF頁數並合併成設定好的一個PDF。
標籤
bat
(54)
作品
(46)
python
(29)
shell
(17)
laravel
(13)
windows
(11)
虛擬機
(11)
Apache2
(10)
php
(10)
CPP
(6)
KMS
(6)
程式設計
(6)
docker
(5)
xoops
(5)
使用教學
(5)
資安
(5)
Ubuntu
(4)
公文
(4)
轉檔
(4)
Excel
(3)
juniper
(3)
資料庫
(3)
mysql
(2)
免動手
(2)
編輯器
(2)
資料結構
(2)
軟體廣播
(2)
電腦維修
(2)
Android Studio
(1)
Apple IPAD管理
(1)
Arduino
(1)
CSS
(1)
Cookies marked as HttpOnly
(1)
HSTS
(1)
Host header attack
(1)
LAMP
(1)
Model
(1)
NAS
(1)
Permissions-Policy
(1)
TLS/SSL Weak Cipher Suites
(1)
VHD
(1)
Windows Server
(1)
原因
(1)
程式應用
(1)
程式積木
(1)
雲端硬碟
(1)
2025年9月21日 星期日
2025年9月13日 星期六
只要點兩下就能利用彰化縣EIP系統學生帳號CSV產出指定學生名單的Google Classroom帳號總表
系列文章:
1.只要點兩下就能產出彰化縣Cloud School 學生帳號密碼匯入彰化縣EIP系統學生帳號密碼的CSV
1.https://skjhcreator.blogspot.com/2025/08/cloud-school-eipcsv.html
2.只要點兩下就能利用彰化縣EIP系統學生帳號CSV產出建立Google Classroom 學生總表
2.https://skjhcreator.blogspot.com/2025/08/eipcsvgoogle-classroom.html
3.只要點兩下就能利用彰化縣EIP系統學生帳號CSV產出指定學生名單的Google Classroom學生帳號總表
3.https://skjhcreator.blogspot.com/2025/09/eipcsvgoogle-classroom.html
1.只要點兩下就能產出彰化縣Cloud School 學生帳號密碼匯入彰化縣EIP系統學生帳號密碼的CSV
1.https://skjhcreator.blogspot.com/2025/08/cloud-school-eipcsv.html
2.只要點兩下就能利用彰化縣EIP系統學生帳號CSV產出建立Google Classroom 學生總表
2.https://skjhcreator.blogspot.com/2025/08/eipcsvgoogle-classroom.html
3.只要點兩下就能利用彰化縣EIP系統學生帳號CSV產出指定學生名單的Google Classroom學生帳號總表
3.https://skjhcreator.blogspot.com/2025/09/eipcsvgoogle-classroom.html
彰化縣數位學習師生單一帳號系統(EIP=Enterprise Information Portal)於2025年7月7日正式啟用。學務處想利用Google Classroom 來建立全校視訊廣播。因此,給資訊組全年級各班班長的年班座號總表。而資訊組要能產出一個全年級各班班長的Classroom 帳號總表,方便學務處將各班班長加入Google Classroom。 而資訊組只要將這件事簡化,只要點兩下就能得到指定學生名單的Google Classroom帳號總表。然後教學務處如何使用這個程式即可。
由於EIP系統學生帳號只有帳號,沒有後面的@chc.edu.tw。還要想辦法將@chc.edu.tw加入。但問題是用Excel開啟CSV,學生帳號只有數字,在Excel 格式就會跑掉。比方說學生帳號0432579,在Excel,就會變成432579。若用記事本開,學生帳號"0432579",完全沒法用尋找、取代等方式來簡單完成。就要複製@chc.edu.tw,然後一個個貼上。
1.EIP學生帳號下載方式:
以下是開發過程與原始碼 (Development process and code):
程式名稱(Program name):pyStudent2ClassRoomStudentAccount.py
程式內容(Code):
import csv
import os
# 取得目前的工作目錄
current_directory = os.getcwd()
# 取得目前的工作目錄內input
current_directory_input = current_directory+"\\input\\"
# 取得工作目錄input內所有檔案名稱
current_directory_input_files = os.listdir(current_directory_input)
# 以副檔名來判斷設定相對應的檔案
for i in current_directory_input_files:
TempFileName,TempFileExtension = os.path.splitext(i)
if TempFileExtension == ".csv":
TempCSVFile = i
elif TempFileExtension == ".xlsx":
TempXLSXFile = i
else:
TempTXT = i
# 設定CSVList為一個 list
CSVList = []
# 開啟 CSV 檔案
with open(current_directory_input+TempCSVFile, mode='r', encoding='utf-8') as file:
# 建立 CSV 讀取器
reader = csv.reader(file)
# 逐行讀取 CSV 檔案內容
for row in reader:
CSVList.append(row)
# CSVListTitle 取得 CSVList[0]
CSVListTitle = CSVList[0]
# 刪除CSVList[0]
CSVList.pop(0)
# 對CSVList 進行排序
CSVList.sort(key=lambda x: x[0])
ResultList = []
ResultList.append(CSVListTitle)
StudentList = []
with open(current_directory_input+TempTXT, "r") as Stufile:
tempStudentList = Stufile.readlines()
for i in tempStudentList:
temp = i.strip("\n")
StudentList.append(temp)
TempStudentSet = set(StudentList)
TempResultSet = set()
for i in StudentList:
for j in CSVList:
if str(i) == str(j[0]):
#print(str(i),str(j[0]))
ResultList.append([str(j[0]),str(j[1])+"@chc.edu.tw"])
TempResultSet.add(str(i))
ExceptionSet = TempStudentSet - TempResultSet
ExceptionList = list(ExceptionSet)
with open(current_directory+"\\Student2ClassRoomStudentAccount.csv","w", newline="", encoding="utf-8") as file:
writer = csv.writer(file)
writer.writerows(ResultList)
print("Student2ClassRoomStudentAccount.csv 檔案已成功寫入!")
with open(current_directory+"\\Student2ClassRoomStudentAccountException.txt", "w",encoding="utf-8") as file:
file.write("Excel 找不到的學生帳號如下:\n")
for i in ExceptionList:
file.write(str(i)+"\n")
print("Student2ClassRoomStudentAccountException.csv 檔案已成功寫入!")
訂閱:
文章 (Atom)
只要點兩下兩次,就能依照設定拆分指定PDF頁數並合併成設定好的一個PDF
最近遇到一個問題,想要對四個不同的PDF,分別擷取1~2頁、3~4頁、5~6頁、7~8頁,合併成一個總共8頁的PDF。那該怎麼寫程式來處理這件事呢?那如果是用線上拆分PDF網頁與線上合併PDF網頁,該怎麼做呢?則是需要將四個不同PDF分別上傳到拆分網頁後再 一頁一...
-
系列文章: 1. 只要點兩下,就能讓Windows 10 擁有Windows 7 的相片檢視器 https://skjhcreator.blogspot.com/2022/12/windows-10-windows-7.html 2. 只要變更設定,就能讓相片顯示器可以看LINE...
-
系列文章: 1. 利用 BAT 一鍵完成印表機安裝驅動 https://skjhmis.blogspot.com/2019/09/bat.html 2. 只要會用滑鼠點兩下,快速產生一堆的印表機一鍵完成驅動安裝.BAT https://skjhmis.blogspot.com/2...
-
第一篇 在 Windows 10 x64 1909版,使用BAT快速安裝人事服務網(自然人憑證)版 第二篇 在 Windows 10 x64 1909版,使用BAT快速安裝公文系統與人事服務網(自然人憑證)版 第三篇 在 Windows 10 x64 1909版,用BAT快...