Skip to content

Tag: printing

How can I use SetJob in win32print?

I want to clear or delete print jobs using Python. But how can I get JobID? win32print.SetJob(hPrinter, JobID , Level , JobInfo , Command) How could I run this code? Answer Starting from your code, I’ve managed to create a small script that deletes any print job on any (local) printer (I’ve tested…

How to output above the last printed line?

Is there a way in python to print something in the command line above the last line printed? Or, similarly to what I want to achieve, remain the last line intact, that is, not overwrite it. The goal of this is to let the last line in the command line a status/precentage bar. Output example: Next refresh: Next…

Python print indentations

In Python 3.x how do you print an indent of white space, the method I am looking for looked something like this should print: repeating answer from below: thanks to @sudo_coffee for t or maybe: Answer sorry guys, think I found the answer, thanks to @sudo_coffee for t or maybe:

Print list of lists in separate lines

I have a list of lists: I want the output in the following format: I have tried it the following way , but the outputs are not in the desired way: Outputs: While changing the print call to use end instead: Outputs: Any ideas? Answer Iterate through every sub-list in your original list and unpack it in the pri…

Get Printer Status Code with win32print

I have read the documentation of win32print which indicates that GetPrinter is the method which is used to obtain the status of the printer. However, this method returns a complete tuple of data and I’m at a loss at to which element indicates the actual status. Any ideas? Answer If you pass Level=2 into…

Printing 2 numbers before comma

I want to print numbers with precision to 2 digits before dot and 3 after. Example: will show: I know that will show me 3 digits after dot but how to get 2 digits before dot with 0 if that is shorter than 2 digits? Answer You can specify a total width for the output; if you include a leading

Print not showing in ipython notebook

I am using ipython notebook (http://ipython.org/notebook.html) to do a demo and it seems like the print function is not working: The commands in the above picture are rewritten here for clarity. In short, there’s no print output from the [2]. Does anyone know whether it’s a known bug? And does any…