Created
December 2, 2019 04:16
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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