Python枕头如何拍摄屏幕截图或将文本转换为imag

2024-06-25 23:30:23 发布

您现在位置:Python中文网/ 问答频道 /正文

再见。

在我的工作中,有时我不得不使用一个脚本从一个数字或ID中获取一些信息

我使用的脚本:

$sh script.sh 9999999999999 abc    

屏幕上显示的信息:

number: 9999999999999

SQL*Plus: Release 1.2.3.4 Production on Wed Jan 10 12:35:22 2017

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database Enterprise Edition Release 1.2.3.4 - 32bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


NUMBER||','||SERVICE||','||CONTRACT_DATE||','||COMFIRMATION
--------------------------------------------------------------------------------
9999999999999,SERVICE_NAME_1,01-OCT-13 10.44.30 AM,Y
9999999999999,SERVICE_NAME_2,08-DEZ-14 09.52.57 AM,N
9999999999999,SERVICE_NAME_3,26-FEB-16 11.42.30 AM,Y

Disconnected from Oracle Database Enterprise Edition Release 1.2.3.4 - 32bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

我想知道如何把脚本返回给我的东西变成一个图像,就像截图一样。


Tags: thename脚本信息releaseshservicewith
1条回答
网友
1楼 · 发布于 2024-06-25 23:30:23

现在是转向Python包索引PyPI的好时机。它提供了许多模块,包括从Python截图。

考虑一下,例如pyscreenshot

使用pip或本地平台特定安装程序安装,然后:

import pyscreenshot
im = pyscreenshot.grab()
im.save('ss.png')

im是PIL/枕头兼容的图像,易于操作或保存到文件中。

相关问题 更多 >