How to stdin with barcode/qrcode scanner in python3 / input data / raspberry pi4 / python

Viewed 25

I am Korean, so the translation may be difficult. There is a qr scanner of usb input. I am trying to process data when data is scanned by qr scanner using Python in the Raspberry Pi 4 environment.

When I scanned the qr code with the qr code scanner, I confirmed that the data was output. But I don't know how to do it with python input.

What should I do? Thank you very much for writing an example of Python code.

1 Answers

Just put

my_qr_code = input("Scan QR code:")

Basic example

print(input("Scan QR code:"))

Any barcode scanner that is recognized by the machine as a HID device will be indistinguishable to the Python interpreter from a person typing the digits comprising the barcode and pressing Enter.

Related