标签:this list nta limit oop ring contain 字符串 china
#!/usr/bin/python
# Filename: str_methods.py
name = ‘Swaroop‘ # This is a string object
if name.startswith(‘Swa‘):
print ‘Yes, the string starts with "Swa"‘
if ‘a‘ in name:
print ‘Yes, it contains the string "a"‘
if name.find(‘war‘) != -1:
print ‘Yes, it contains the string "war"‘
delimiter = ‘_*_‘
mylist = [‘Brazil‘, ‘Russia‘, ‘India‘, ‘China‘]
print delimiter.join(mylist)
标签:this list nta limit oop ring contain 字符串 china
原文地址:http://www.cnblogs.com/nku-wangfeng/p/7688963.html