removing linebreaks in python?
Question: I'm working on a simple python game in which the player attempts to guess
letters contained in a word. The problem is, when I print a word, it's
printing the \n at the end.

From my initial research, I think I need to use r.string() to remove it.
However, I'm not sure where it would go.

Sorry for the newbie question.

    
    
    import random
    with open('wordlist.txt') as wordList:
        secretWord = random.sample(list(wordList), 1)
    
    print (secretWord)
    


Answer: You can use `.strip()` to strip out whitespace:

    
    
    secret_word = random.choice(wordList).strip()
    

