回答編集履歴
3
些細
test
CHANGED
@@ -23,7 +23,7 @@
|
|
23
23
|
```python
|
24
24
|
tp = 1,
|
25
25
|
```
|
26
|
-
と書くことで
|
26
|
+
と書くことでひとつの要素を持つタプルを生成します。(`()`に意味がないと先に書いた通り、`()`の必要はありません)
|
27
27
|
|
28
28
|
公式ドキュメントだとここに書いてあります。
|
29
29
|
[https://docs.python.org/ja/3/tutorial/datastructures.html#tuples-and-sequences](https://docs.python.org/ja/3/tutorial/datastructures.html#tuples-and-sequences)
|
2
URL追加
test
CHANGED
@@ -26,5 +26,8 @@
|
|
26
26
|
と書くことで1つの値を持つタプルを生成します。(`()`に意味がないと先に書いた通り、`()`の必要はありません)
|
27
27
|
|
28
28
|
公式ドキュメントだとここに書いてあります。
|
29
|
+
[https://docs.python.org/ja/3/tutorial/datastructures.html#tuples-and-sequences](https://docs.python.org/ja/3/tutorial/datastructures.html#tuples-and-sequences)
|
30
|
+
> 一つの要素を持つタプルは、値の後ろにコンマを続ける (単一の値を丸括弧で囲むだけでは不十分です) ことで構築できます。
|
31
|
+
|
29
32
|
[https://docs.python.org/ja/3/reference/datamodel.html#index-20](https://docs.python.org/ja/3/reference/datamodel.html#index-20)
|
30
33
|
> 単一の要素からなるタプル (単集合 'singleton') を作るには、要素を表現する式の直後にカンマをつけます (単一の式だけではタプルを形成しません。これは、式をグループ化するのに丸括弧を使えるようにしなければならないからです)。
|
1
変更
test
CHANGED
@@ -19,10 +19,11 @@
|
|
19
19
|
tp = (1,)
|
20
20
|
```
|
21
21
|
と書いた時に**意味があるのは`,`の方です**。
|
22
|
+
|
22
23
|
```python
|
23
24
|
tp = 1,
|
24
25
|
```
|
25
|
-
と書
|
26
|
+
と書くことで1つの値を持つタプルを生成します。(`()`に意味がないと先に書いた通り、`()`の必要はありません)
|
26
27
|
|
27
28
|
公式ドキュメントだとここに書いてあります。
|
28
29
|
[https://docs.python.org/ja/3/reference/datamodel.html#index-20](https://docs.python.org/ja/3/reference/datamodel.html#index-20)
|