エントリーの編集
エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
リスト - 作成、取り出し、置換、追加、検索、削除、要素数 - ひきメモ
作成 >>> list = ["a", "b", "c", "d", "e"] >>> list ['a', 'b', 'c', 'd', 'e'] 取り出し >>> list = ... 作成 >>> list = ["a", "b", "c", "d", "e"] >>> list ['a', 'b', 'c', 'd', 'e'] 取り出し >>> list = ["a", "b", "c", "d", "e"] # n番目の要素を取り出す >>> list[0] 'a' # インデクスが負の数だと後ろから数える >>> list[-1] 'e' # 範囲外のインデクスを指定するとエラー >>> list[10] Traceback (most recent call last): File "<stdin>", line 1, in <module> IndexError: list index out of range # n番目からm-1番目の要素を取り出す >>> list[1:4] ['b', 'c', 'd'] # 始点を省略すると0番目から >>> lis
2014/03/09 リンク