Skip to content

Instantly share code, notes, and snippets.

@wwj718
Created June 4, 2018 06:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wwj718/390e0abca02742f3a7c7147aa45bd654 to your computer and use it in GitHub Desktop.
Save wwj718/390e0abca02742f3a7c7147aa45bd654 to your computer and use it in GitHub Desktop.
批量打印
# 打印lpr
import subprocess
import pathlib
p = pathlib.Path('.')
# 列出目录下所有png图片名
imgs = list(p.glob('**/*.png'))[:2]
for i in imgs:
cmd = "lpr {}".format(i)
print(cmd)
subprocess.call(cmd,shell=True)
print("ok")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment