美好的一天。
在我的工作中,有时我必须使用脚本从数字或ID中获取一些信息。就像下面的例子:
我使用的脚本:
$sh script.sh 9999999999999 abc
Run Code Online (Sandbox Code Playgroud)
屏幕上显示的信息:
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
Run Code Online (Sandbox Code Playgroud)
我想知道如何将脚本返回的内容转换为图像,就像拍摄终端屏幕截图一样。
这将是转向Python软件包索引PyPI的绝佳时机。它提供了许多功能的模块,包括从Python截屏。
考虑一下,例如pyscreenshot。
使用pip或您本地特定于平台的安装程序进行安装,然后:
import pyscreenshot
im = pyscreenshot.grab()
im.save('ss.png')
Run Code Online (Sandbox Code Playgroud)
im 是与PIL / Pillow兼容的图像,易于操作或保存到文件中。
| 归档时间: |
|
| 查看次数: |
5696 次 |
| 最近记录: |