パスワードを忘れた? アカウント作成
14259559 journal
Python

finedaypicnicの日記: リストの追加部分以外が本当に合っているかの確認方法

日記 by finedaypicnic

Python 3.8.2 (default, Jul 16 2020, 14:00:26)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> a = ["a", "b", "c"]
>>> b = ["a", "b", "c", "d"]
>>> l = len(a)
>>> l
3
>>> l = len(a[:-1])
>>> l
2
>>> c = a[:l]
>>> d = b[:l]
>>> print(c and d)
['a', 'b']
>>> print(c == d)
True
>>> e = "".join(a)
>>> e
'abc'
>>> f = "".join(b)
>>> f
'abcd'
>>> l = len(e)
>>> l
3
>>> g = f[:l]
>>> g
'abc'
>>> print(e == g)
True

typodupeerror

身近な人の偉大さは半減する -- あるアレゲ人

読み込み中...