While taking a list as an input from the user, the input is SUPPOSED to be enclosed within square brackets as opposed to just typing the numbers This is my code for taking multiple inputs from the user for a list
a = list(map(int,input().strip().split(', ')))
The default input is [1, 2, 3, 4]. When I run my code, I get an error as:
ValueError: invalid literal for int() with base 10: '[1'
I know the reason it's happening is because '[1' is a an element that cannot be converted into int and it (the square bracket and 1) is being regarded as the first element of the list at index 0. Having the square bracket is absolutely essential for me, how can I resolve the error or just ignore the square brackets? Is there an ignore method or something similar that might work? Cheers!