Skip to content

Instantly share code, notes, and snippets.

@ollytheninja
Created December 2, 2019 04:16
Show Gist options
  • Save ollytheninja/643620a277d0a288e92b2c8682264ec0 to your computer and use it in GitHub Desktop.
Save ollytheninja/643620a277d0a288e92b2c8682264ec0 to your computer and use it in GitHub Desktop.
silly little script for pairing things together in a CSV, used to pair a barcode and RFID card serial together
import os
output_file = "card_pairs.csv"
magic_number = 4
if output_file not in os.listdir('.'):
with open(output_file, "w") as f:
f.write("id_number,card_serial\n")
while 1:
a = input("scan card:")
b = input("waiting for second input:")
print("{} {}".format(a,b))
if len(a) > magic_number:
card_serial = a
id_number = b
else:
card_serial = b
id_number = a
with open(output_file, "a") as f:
f.write("{},{}\n".format(id_number,card_serial))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment