Boolean (bool)

A boolean object which is either true or false

Returned by

Boolean objects are returned by the following functions and methods:

Boolean methods

bool.to_int()

Returns 1 if true and 0 if false

Signature

(追記) int (追記ここまで) to_int()

bool.to_string()

Returns the string 'true' if the boolean is true or 'false' otherwise. You can also pass it two strings as positional arguments to specify what to return for true/false. For instance, bool.to_string('yes', 'no') will return yes if the boolean is true and no if it is false.

Signature

# Returns the string `'true'` if the boolean is true or `'false'` otherwise
(追記) str (追記ここまで) to_string(
 (追記) str (追記ここまで) [true_str], # The string to return when the boolean is `true`
 (追記) str (追記ここまで) [false_str], # The string to return when the boolean is `false`
)

Arguments

The method bool.to_string() accepts the following positional arguments:

Name Type Description Tags
true_str (追記) str (追記ここまで)

The string to return when the boolean is true

[optional]

default = 'true'

false_str (追記) str (追記ここまで)

The string to return when the boolean is false

[optional]

default = 'false'


The results of the search are

AltStyle によって変換されたページ (->オリジナル) /