I'm editing this post because I didn't do a good job explaining my question, so here goes again. I'm working with the tabulate library. I'm looking to use input()
to automatically adjust the number of columns/rows in a table based off the input given. Here's a basic example:
#!/bin/python3
from tabulate import tabulate
uid1 = input('UID > ')
uid2 = input('UID > ')
name1 = input('NAME > ')
name2 = input('NAME > ')
number1 = input('NUMBER > ')
number2 = input('NUMBER > ')
headers = ["UID", "NAME","NUMBER"]
table = [[uid1,name1,number1],[uid2,name2,number2]]
print(tabulate(table, headers, tablefmt="fancy_grid"))
╒═══════╤═════════╤══════════╕
│ UID │ NAME │ NUMBER │
╞═══════╪═════════╪══════════╡
│ 0 │ SHAWN │ 333-4444 │
├───────┼─────────┼──────────┤
│ 1 │ MICHAEL │ 222-3333 │
╘═══════╧═════════╧══════════╛
But the next time the script runs, there are more columns/tables:
╒═══════╤════════╤══════════╕
│ UID │ NAME │ NUMBER │
╞═══════╪════════╪══════════╡
│ 0 │ JAMES │ 444-5555 │
├───────┼────────┼──────────┤
│ 1 │ ANDREW │ 666-3333 │
├───────┼────────┼──────────┤
│ 2 │ SHAWN │ 444-3333 │
╘═══════╧════════╧══════════╛
So I'm trying to figure out a way to adjust the given values for rows and columns with a for loop or something but I can't figure it out. I'd like to have something like:
UIDs = input('Enter all UIDs $ ')
NAMES = input('Enter all names $ ')
NUMBERS = int(input('Enter all numbers $')