python中的一些小問題

問題:如何將字符串類型的列表轉換成列表格式:html 方法一: python a = "[1, 2, 3, 4, 5]" print("原字符串是:{},類型是{}".format(a, type(a))) # 去除左右的[] a_del = a[1:-1] print("去除[]以後的字符串是:{}".format(a_del)) print() # 使用列表推導式去除「,」,並將每個元素轉
相關文章
相關標籤/搜索