Python short course: Convert String List to List

We can use the method below to convert a string list to list.


import ast
string_list = "['hello', 'world']"
ast.literal_eval(string_list)

Comments

Popular posts from this blog

Lab's weekly topic - week 50 2023 - Detailed explanation for encoder of U-Net

Lab's recommendation: Awesome books to learn machine learning and AI (continue updating)