整數 (int)

所有整數數字。請參閱 數字 以獲取更多資訊。

由以下項目回傳

整數物件由下列函式和方法回傳

整數方法

int.is_even()

如果數字是偶數則回傳 true。

簽名

bool is_even()


int.is_odd()

如果數字是奇數則回傳 true

簽名

bool is_odd()


int.to_string()

將數字的值回傳為字串。

簽名

# Returns the value of the number as a string
str to_string(
  int [fill],   # Left fill the string with zeros until it reaches the length
)

引數

方法 int.to_string() 接受下列位置引數

名稱 類型 描述 標籤
fill (填充) int (整數)

使用零向左填充字串,直到達到此引數指定的長度。前導負號計入長度,並通過在 - 字元之後而不是之前插入填充來處理。如果提供的值小於或等於前者的長度,則回傳原始字串。

[選用]


搜尋結果為