我看到有使用作業系統庫的選項,但我如何用它列印圖片?例如,.png 檔案? 我不想看到影像,我想用 Python 用列印機列印它
import os
os.startfile("C:/Users/gilke/Downloads/File1.txt", "print")
uj5u.com熱心網友回復:
這僅適用于 Windows(10 或 11):
您可以執行以下操作:
import os
os.startfile("C:/Users/TestFile.txt", "print")
這將在其默認打開器中啟動檔案,并使用動詞“print”,它將列印到您的默認列印機。只需要os標準庫自帶的模塊
uj5u.com熱心網友回復:
第一件事首先pip install Pillow在您的終端中輸入然后按回車鍵
from PIL import Image
myImage=Image.open("Your Image here");
myImage.show()
就像在stackOverflow上上傳問題一樣簡單
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/358852.html
