x = input(Fore.YELLOW + "What specific account would you like to print? (Input 0 for line 1)\n" + Fore.RED)
c = accountlines[105].split("`") # Change [0] to whichever line number (minus 1) that you would like to print, so for line 10, put [9].
email = c[1]
password = c[3]
print(Fore.BLUE + f"----------------------------------------------------------\n{email}:{password}\n----------------------------------------------------------" + Fore.WHITE)
I'm trying to have an input which would represent an element number. So, if you would like to call the 106th element in the array, you would put 105 when it asks for an input. This would lead x to equal 105, so I would like to replace the [105] in c with [x], but the brackets ask for an integer, and returns the following error when you use a variable instead:
Traceback (most recent call last):
File "account.py", line 30, in <module>
print(all_lines[x])
TypeError: list indices must be integers or slices, not str
Is it possible to use a variable in place of this integer? What would I need to do to accomplish this? Thanks :)