Hello everyone, question about returning multiple values from a function, and then parsing through that return and grabbing what I need in a different function, any tips or tricks. For reference, I'm returning 3 values, the first a IP address, the second the initial user response, and finally a false to end the while loop. Thanks in advance. def main():
while True:
u_response = input("NIC IP: 1\nBMC IP: 2\nExit: 3 ")
#basic user repsonse, to be checked.
if u_response.isdigit():
u_response = int(u_response)
match u_response:
case 1:
sys.stdout.write("Input IP: ")
sys.stdout.flush()
u_reply = sys.stdin.readline()
return u_reply, u_response, False
case 2:
sys.stdout.write("Input IP: ")
sys.stdout.flush()
u_reply = sys.stdin.readline()
return u_reply, u_response, False
case 3:
print("Thank you for using the script.")
return
case _:
print("Invalid response")
else:
print("Invalid response")
#This will validate the ip / IPV4
def ip_validation():
pass