有人能说出为什么我收到这个错误?这似乎错误发生时,len个(freqsetlist)是> 1。这与3元
Can someone point out why I am getting this error? It seems the error occur when len(freqsetlist) is > 1. That is when calculating tuple with 3 element
推荐答案这是对象的再presentation,如果你想要一个不同的再presentation,你将不得不自己构造它:
That is the representation of the object, if you want a different representation, you will have to construct it yourself:
>>> k = ['van'] >>> "({})".format(", ".join(k)) '(van)'请注意,这意味着你使用一个对象作为程序的一部分,Python的重新presentation,这是一个坏主意,你应该始终建立你所需要的人工,而不是尝试使用Python的重新presentation,其目的是用于调试。
Note that this implies you are using Python's representation of an object as a part of your program, this is a bad idea, and you should always construct what you need manually rather than try and use Python's representation, which is intended for debugging.
编辑:逗号是显示它是一个元组,括号内为默认情况下,意味着操作,而不是元组的分组Python的方式。你可以使自己的元组的子类,并修改 __再版__() / __ STR __()如果你真的想要的,但将是难以置信的毫无意义的(和unpythonic在的情况下, __ __再版(),因为它应该评估的对象)。
The comma is Python's way of showing it's a tuple, as brackets signify grouping of operations rather than tuples by default. You could make your own tuple subclass and change the __repr__()/__str__() if you really wanted, but that would be incredibly pointless (and unpythonic in the case of __repr__() as it should evaluate to the object).
更多推荐
信心在计算关联规则
发布评论