山姆的編程實作分享。。。

Sam Blog, Sam Sharing, Sam Studio

2019年5月30日

Python 讀書筆記 (6) : Python Basics


讀完這章節:
1. 發現Python對字串的處理太強了, 忍不住要給它個讚!

2. 字串的並列(Concatenation)及複製(Replication)竟然用 "+" , "*" 就可以辦到了
-----------------------------------------------------
>>> "Sam" + "Chen"
'SamChen'
>>> "Sam" * 5
'SamSamSamSamSam'
-----------------------------------------------------

3. Common Data Type : Integer, Floating-point, Strings 可以透過 str(), int(), float() 輕易的轉型
-----------------------------------------------------
>>> Var = input(">>")
>>12345
>>> print(Var)
12345
>>> str(Var)
'12345'
>>> int(Var)
12345
>>> float(Var)
12345.0
>>> str(Var)
'12345'
>>> int(Var)
12345
--------------------------------------------------------

4. 對Python想要更深入了解它的語法或定義, 可以到 Python 官網閱讀
Python Document (English版)
Python Document (簡中版)

熱門文章