【发布时间】:2015-09-25 04:32:25
【问题描述】:
我从一个文件中读取了一些元组数据。元组是字符串形式的,例如Color["RED"] = '(255,0,0)'。如何将这些字符串转换为实际的元组?
我想像这样在 PyGame 中使用这些数据:
gameDisplay.fill(Color["RED"])
# but it doesn't have the right data right now:
gameDisplay.fill('(255,0,0)')
【问题讨论】:
标签: python string parsing pygame tuples