Python - Lists of Numbers: Processing List Data - string, methods, rstrip, split
Head First Python: A Learner’s Guide to the Fundamentals of Python Programming, A Brain-Friendly Guide、 Paul Barry(著)、 O’Reilly Mediaの Chapter 3.(Lists of Numbers: Processing List Data)、SHARPEN YOUR PENCIL(30/101)の解答を求めてみる。
Jupyter(コード、入出力結果)
Average.ipynb
lines[0]
'1:27.95,1:21.07,1:30.96,1:23.22,1:27.95,1:28.30\n'
lines[0].rstrip('\n')
'1:27.95,1:21.07,1:30.96,1:23.22,1:27.95,1:28.30'
lines[0].rstrip('\n').split(',')
['1:27.95', '1:21.07', '1:30.96', '1:23.22', '1:27.95', '1:28.30']