Python commands

Robin Munn rmunn at
Thu Apr 3 12:10:59 CEST 2003

Paul Dexter <dextech at> wrote:
>     Hi all,
>                 I have just discovered Python and I was wondering if anyone
> could help me find an equivalent command in Python for the "OUT" and "INP"
> commands in Qbasic. I wish to convert a Qbasic program to Python.
>     The following snippet is an example of the task I wish to perform;
> base0 = &H378:
> interface:
> OUT base0, &HA0
> OUT base0, &H80
> OUT base0 + 2, &H8
> V = (INP(base0 + 1) AND &H10) * &H8

Ewww, direct printer port interfacing. Nasty.

>     The base address is 378 (lpt) and the "interface" subroutine outputs
> data to the port (378) and "V" is the input data statement I have used. I
> also use the "GETKEY", "LOCATE" and "DRAW" commands in Qbasic
>     Does anyone know how to perform the same tasks/commands in Python or are
> they even available. I have come across other Basic computer language
> variations that do not support the commands I require.

Personally, I'd want to stay far away from direct printer interfacing;
let the drivers do the work for you. But if you really have to, then the
winioport module might be what you need:

I found it by doing a Google search for "python parallel port".

Robin Munn <rmunn at>
PGP key ID: 0x6AFB6838    50FF 2478 CFFB 081A 8338  54F7 845D ACFD 6AFB 6838

More information about the Python-list mailing list