Je suis sur python 3.6.9
J'ai besoin de récupérer dans une liste les noms des imprimantes
comme ceci :
laurent@Laurent-I7-9900K:~$ lpstat -s system default destination: PDF matériel pour Brother_MFC_9340CDW : ipp://BRN3C2AF4066966.local:631/ipp/print matériel pour Brother_MFC_J5730DW : ipp://BRN3C2AF4C24E17.local:631/ipp/print matériel pour MFC9340CDW : dnssd://Brother%20MFC-9340CDW._ipp._tcp.local/?uuid=e3248000-80ce-11db-8000-3c2af4066966 matériel pour OfficeJet-3830-series : hp:/usb/OfficeJet_3830_series?serial=CN8C16Q02B06VZ matériel pour OfficeJet-3830-series-Fax-4 : hpfax:/usb/OfficeJet_3830_series?serial=CN8C16Q02B06VZ matériel pour PDF : cups-pdf:/ laurent@Laurent-I7-9900K:~$
selectionner_imprimante ----------------------- system default destination: PDF matériel pour Brother_MFC_9340CDW : ipp://BRN3C2AF4066966.local:631/ipp/print matériel pour Brother_MFC_J5730DW : ipp://BRN3C2AF4C24E17.local:631/ipp/print matériel pour MFC9340CDW : dnssd://Brother%20MFC-9340CDW._ipp._tcp.local/?uuid=e3248000-80ce-11db-8000-3c2af4066966 matériel pour OfficeJet-3830-series : hp:/usb/OfficeJet_3830_series?serial=CN8C16Q02B06VZ matériel pour OfficeJet-3830-series-Fax-4 : hpfax:/usb/OfficeJet_3830_series?serial=CN8C16Q02B06VZ matériel pour PDF : cups-pdf:/ LISTE_IMPRIMANTES : [0]
Avec
cmd1 = os.system(CMD1)
et
cmd1 = subprocess.call(['lpstat', '-s'])
il liste les imprimantes mais impossible de les ajouter dans une liste ?
Merci d'avance pour vos conseils et avis.
Configuration: Linux / Firefox 85.0
A voir également:
Python 3 Récuperer dans une liste le nom des imprimantes
Faux débutant python, je découvre vos scripts et vos références.
Merci pour le partage.