作者harold1018 ( )
看板Python
標題[問題] string to variable?
時間Tue Jun 28 15:03:55 2022
ex.
my_list = ["a", "b", "c"]
請問要怎麼變成以下 (variable)
my_list = [a, b, c]
有什麼function 或 module 可以用嗎?
感謝!
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.163.152.35 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1656399837.A.277.html
→ melancholy07: eval? 06/28 15:07
→ harold1018: 好像...不行耶@@" 06/28 15:19
→ harold1018: 欸等等我成功了 感謝一樓 06/28 15:45