\n (and not /n) is how you put a literal newline in strings (other than multi-line strings). Any basic tutorial should mention it. If yours didn't, you should read a different one.
Here's an alternative way to do it, assuming you have an iterable of the words (you can get it with the string and .splitlines() or .split('\n'))
- Code: Select all
>>> words = ['testa', 'testb', 'testc']
For what you have here, the .replace() method is probably better though.
Join the #python-forum IRC channel on irc.freenode.net for off-topic chat!
Please prefer not to PM members. The point of the forum is so that anyone can benefit. We don't want to help you over PMs/emails/Skype chats that others can't benefit from