# -*- coding: utf-8 -*-
#python 27
#xiaodeng
#python之函数用法startswith()
#http://www.runoob.com/python/att-string-startswith.html #startswith()
#说明:返回布尔值,用于检查字符串是否是以指定子字符串开头,如果是则返回 True,否则返回 False。
'''
startswith(...)
S.startswith(prefix[, start[, end]]) -> bool
prefix:前缀
start:字符串的开始位置
end:字符串结束位置 Return True if S starts with the specified prefix, False otherwise.
With optional start, test S beginning at that position.
With optional end, stop comparing S at that position.
prefix can also be a tuple of strings to try.
''' #案例
#判断字符串是否以指定字符串开头
str='xiaodeng love python'
prefix='xiaodeng'
print str.startswith(prefix)#True
prefix='deng'
print str.startswith(prefix,4)#True
prefix='love'
print str.startswith(prefix,4,13)#True

python之函数用法startswith()的更多相关文章

  1. Python回调函数用法实例详解

    本文实例讲述了Python回调函数用法.分享给大家供大家参考.具体分析如下: 一.百度百科上对回调函数的解释: 回调函数就是一个通过函数指针调用的函数.如果你把函数的指针(地址)作为参数传递给另一个函 ...

  2. python之函数用法setdefault()

    # -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法setdefault() #D.get(k,d) #说明:k在D中,则返回 D[K], ...

  3. python之函数用法fromkeys()

    # -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法fromkeys() #fromkeys() #说明:用于创建一个新字典,以序列seq ...

  4. python之函数用法get()

    # -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法get() #http://www.runoob.com/python/att-dic ...

  5. python之函数用法capitalize()

    # -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法capitalize() #capitalize() #说明:将字符串的第一个字母变成 ...

  6. python之函数用法isupper()

    # -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法isupper() #http://www.runoob.com/python/att ...

  7. python之函数用法islower()

    # -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法islower() #http://www.runoob.com/python/att ...

  8. python之函数用法endswith()

    # -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法endswith() #http://www.runoob.com/python/at ...

  9. python之函数用法xrange()

    # -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法xrange() #xrange() #说明:返回一个生成器 #xrange做循环的性 ...

随机推荐

  1. Cannot find snapshot in models/VGGNet/VOC0712/SSD_300x300

    错误描述: 执行 python examples/ssd/ssd_pascal.py 报错: Cannot find snapshot in models/VGGNet/VOC0712/SSD_300 ...

  2. Netty 4.0.0.CR6 发布,高性能网络服务框架

    Netty 4.0 发布第 6 个 RC 版本,该版本值得关注的改进有: SslHandler and JZlibEncoder now works correctly. (#1475 and #14 ...

  3. jquery each循环遍历完再执行的方法 因为each是异步的 所以要加计数器.

    query each循环遍历完再执行的方法因为each是异步的 所以要加计数器.var eachcount=0;$(“.emptytip”).each(function(){ eachcount++c ...

  4. SQLServer中merge函数用法详解

    http://www.jb51.net/article/75302.htm Merge关键字是一个神奇的DML关键字.它在SQL Server 2008被引入,它能将Insert,Update,Del ...

  5. dubbo源码解析-spi(二)

    前言 上一篇简单的介绍了spi的基本一些概念,在末尾也提到了,dubbo对jdk的spi进行了一些改进,具体改进了什么,来看看文档的描述 JDK 标准的 SPI 会一次性实例化扩展点所有实现,如果有扩 ...

  6. go语言之进阶篇通过range遍历channel内容

    1.通过range遍历channel内容 package main import ( "fmt" ) func main() { ch := make(chan int) //创建 ...

  7. Commands to help you to Start Using ScaleIO Storage

    To start using your storage: Log in to the MDM: scli --login --username admin --password <passwor ...

  8. Construct Binary Tree from Inorder and Postorder Traversal Traversal leetcode java

    题目: Given inorder and postorder traversal of a tree, construct the binary tree. Note: You may assume ...

  9. 8天学通MongoDB——第一天 基础入门(转)

    关于mongodb的好处,优点之类的这里就不说了,唯一要讲的一点就是mongodb中有三元素:数据库,集合,文档,其中“集合” 就是对应关系数据库中的“表”,“文档”对应“行”. 一: 下载 上Mon ...

  10. JS实现千分位

    方法一:正则实现 function format (num) { ,}(?=(\d{})+$)/g; return (num + '').replace(reg, '$&,'); } 解释: ...