Using string index
# How i can make list from str '[60, 80]'? Code: string = '[60, 80]' print(type(string)) print(eval(f'list({string})')) print(type(eval(f'list({string})'))) Output: <class 'str'> [60, 80] <class 'list'> [Program finished]
Brilliant, thanks
Eval is dangerous. Most IDEs give you lint errors if you use it. But this solution does work. Keep it up!
yeah, i use eval too but i filter the input as strictly as possible to ensure there will be no malicious inputs
Eval
Yes I've heard never use eval and exec. Thanks😁
I thought you'll say regex
Обсуждают сегодня