2

尝试制作冻结集时出现此错误:

class Transcriber:

    DNA_BASES = frozenset('A','T','G','C')
... 

这是回溯:

~/python/project5$ python wp_proj5.py 
Traceback (most recent call last):
  File "wp_proj5.py", line 5, in <module>
    class Transcriber:
  File "wp_proj5.py", line 7, in Transcriber
    DNA_BASES = frozenset('A','T','G','C')
TypeError: frozenset expected at most 1 arguments, got 4

这里有什么问题?我不能用多个字符串初始化一个 freezeset 吗?

4

1 回答 1

2

您需要传递一个像列表一样的可迭代对象:

frozenset(['A','T','G','C'])

你可以在这里阅读:http: //docs.python.org/2/library/stdtypes.html#frozenset

于 2013-05-19T15:35:59.163 回答