Python 擷取字串片段
 
str = "This is a string"
# from 5 to the end
print str[5:]
# from start to 5
print str[:5]
# from 5 to 7
print str[5:7]
 
以上程式片結果為
is a string
This
is
類似 C# 的 substring
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 流風羽 的頭像
    流風羽

    流風羽的部落格

    流風羽 發表在 痞客邦 留言(0) 人氣()