我正在尝试从一个文件中读取几个用逗号分隔的元组。示例输入文件如下所示:
(0, 0), (0, 2), (0, 4), (-1, -1), (0, -2), (1, -1), (-1, -3),
(-1, 1), (-1, 3), (1, 1), (1, 3), (1, 5), (2, 0), (2, 2), (3, 3),
(2, 4), (3, 5), (4, 4), (5, 3), (6, 4), (5, 5), (7, 5)
从这个文件中读取后,我需要一个这样的元组:
G = ((0, 0), (0, 2), (0, 4), (-1, -1), (0, -2), (1, -1), (-1, -3), \
(-1, 1), (-1, 3), (1, 1), (1, 3), (1, 5), (2, 0), (2, 2), (3, 3), \
(2, 4), (3, 5), (4, 4), (5, 3), (6, 4), (5, 5), (7, 5))
如何有效地做到这一点?问候。