1
我正在嘗試將我的磁盤狀態寫入pdf。問題在於它沒有寫多行文字:每個字母的文字都是垂直的。Python Reportlab多行
import subprocess
from reportlab.pdfgen import canvas
p = subprocess.Popen('df -h', stdout=subprocess.PIPE, shell=True)
(disk, err) = p.communicate()
print disk
def hello(disk):
height= 700
c = canvas.Canvas("diskreport.pdf")
c.drawString(200,800,"Diskreport")
for line in disk:
c.drawString(100,height,line.strip())
height = height - 25
c.showPage()
c.save()
hello(disk)