标签:lame word text 第一个 pos int search 编程 new
1.编程python学习了三个函数
①find(str,pos_start,pos_end)
search = ‘168‘
num_a = ‘1386-168-0006‘
num_b = ‘1681-222-0006‘
print(search + ‘ is at ‘ + str(num_a.find(search)) + ‘ to ‘ + str(num_a.find(search) + len(search)) + ‘ of num_a‘)
def text_filter(word,censored_word = ‘lame‘,changed_word = ‘Awesome‘):
return word.replace(censored_word,changed_word)
print(text_filter(‘Python is lame!‘))#实现过滤,lame替换为Awesome
③abs()函数
解释:返回数字的绝对值
20170417学习find、replace、abs三个函数
标签:lame word text 第一个 pos int search 编程 new
原文地址:http://www.cnblogs.com/Jiang190/p/6721899.html