Once you are familiar with managing a POP3 mailbox with poplib and getting login information with getpass, you can use the two together to access (or "pop") any mailbox on-the-fly. First things first, import the relevant modules:
import getpass, poplibThen get the username. Using Python's built-in input() function here will consistently result in errors. input() treats all strings as variable names - even email logins. Therefore, you need to use raw_input() to ensure the string is not misunderstood.
user = raw_input('Username:')This gives the user a prompt of "Username:" and places the ensuing input into a variable user.
