Python Forum

Full Version: Get partial string from os.system()
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

Why is impossible slice this line os.system(dp)?
I try convert to string, but din't work.

import os

# Verificar se a impressora padrão é uma sebra
dp = "lpq"

rs = os.system(dp)

print(rs)
Output:
PDF is ready no entries 0
I would like take this part
Output:
PDF is ready
Hi i solved m question use this lib:pycups in https://github.com/OpenPrinting/pycups

import cups

defaul_printer = conn.getDefault()
Thanks