Skip to content Skip to sidebar Skip to footer

Python Raw_input Use Tab Instead Of Enter?

I've made this little script to handle a CSV export from my store's point of sale. It takes a list of barcodes entered by our barcode scanner. Then looks up those items in a list t

Solution 1:

You cannot; raw_input() only returns control when ENTER has been entered.

Read directly from sys.stdin directly instead:

barcode = []
while True:
    char = sys.stdin.read(1)  # read1 character from stdinifchar == '\t':  # if a tab was readbreak
    barcode.append(char)
countlist.append(''.join(barcode))

Post a Comment for "Python Raw_input Use Tab Instead Of Enter?"