def getGuessedWord(secretWord, lettersGuessed): for i in secretWord: if i not in lettersGuessed: secretWord=secretWord.replace(i,'_ ')#这里如果去掉secretWord=就不对,如果直接print secretWord.replace(i,'_ ')也是错误的!这是为什么呢?? print secretWord getGuessedWord('ndssfwe', ['z', 'x', 'q', 'c','o', 'n', 'u', 't'])
正确打印出来是 n_ _ _ _ _ _
asd8532
慕粉2015185253
相关分类