どうも、ちょげ(@chogetarou)です。
Set(セット)をタプル(Tuple)に変換する方法を紹介します。
方法

Set(セット)をタプル(Tuple)に変換するには、tuple()を使います。
まず、tuple()を呼び出します。
そして、tuple()の引数にSetを指定します。
my_tuple = tuple(my_set)
上記のtuple()は、Setをタプル(Tuple)に変換します。
使用例
my_set = {1, 2, 3, 4, 5}
my_tuple = tuple(my_set)
print(my_tuple)
print(type(my_tuple))
出力:
(1, 2, 3, 4, 5)
<class 'tuple'>
コメント