首页 > 代码库 > python编程快速上手之第8章实践项目参考答案(8.9.2)

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

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)