码迷,mamicode.com
首页 > 编程语言 > 详细

python编程快速上手之第8章实践项目参考答案(8.9.2)

时间:2017-04-12 22:59:30      阅读:170      评论:0      收藏:0      [点我收藏+]

标签:walk   cte   sub   imp   input   inf   import   lower   nts   

b=‘The ADJECTIVE panda walked to the NOUN and then VERB. A nearby NOUN was unaffected by these events.‘
import re
keyword=[‘ADJECTIVE‘,‘NOUN‘,‘VERB‘,‘NOUN‘]
word=‘‘
s=‘‘
for n in range(len(keyword)):
  word = keyword[n]
  strinfo = re.compile(word)
  s = input(‘Enter an ‘+word.lower()+‘:\n‘)
  b = strinfo.sub(s,b,count=1)
print(b)

python编程快速上手之第8章实践项目参考答案(8.9.2)

标签:walk   cte   sub   imp   input   inf   import   lower   nts   

原文地址:http://www.cnblogs.com/flying-wyf/p/6701776.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!