# startswith()の使い方

Home String Methods

# startswith()の例1

Check if the string starts with "Hello":

    txt = "Hello, welcome to my world."x = txt.startswith("Hello")print(x)

# startswith()の定義と使い方

startswith()関数は、 stringは指定した値で始まります。それ以外の場合はFalseです。

# startswith()の構文

string.startswith(value, start, end)

# startswith()の引数

パラメータ 説明

value:必須. The value to check if the string starts with

start オプション. An Integer specifying at which position to start the search

end オプション. An Integer specifying at which position to end the search

# startswith()の例2

Check if position 7 to 20 starts with the characters "wel":

    txt = "Hello, welcome to my world."x = txt.startswith("wel", 
    7, 20)
    print(x)

Home String Methods