計算機科学のブログ

ほしい物リスト

Python - List of Files: Functions, Modules and Files - string, in

Head First Python: A Learner’s Guide to the Fundamentals of Python Programming, A Brain-Friendly GuidePaul Barry(著)、 O’Reilly Mediaの Chapter 4.(List of Files: Functions, Modules & Files)、SHARPEN YOUR PENCIL(236/682)の解答を求めてみる。

Jupyter(コード、入出力結果)

Files.ipynb

t = '1:23.45'
if ':' in t:
    minutes, rest = t.split(':')
    seconds, hundredths = rest.split('.')
minutes, seconds, hundredths
('1', '23', '45')
':' in t
True