Understanding the main method of python [duplicate]

The Python approach to “main” is almost unique to the language(*). The semantics are a bit subtle. The __name__ identifier is bound to the name of any module as it’s being imported. However, when a file is being executed then __name__ is set to “__main__” (the literal string: __main__). This is almost always used to separate the portion of code which should … Read more

Praw & Discord.py: The bot keep sending the same meme. I want the bot to send different meme whenever it is asked

There is no need for you to iterate over anything. Praw provides a method which allows you to grab a random submission from a subreddit. Documentation: random() Code: Note: I have move the random_submission inside the If-statement because there is no need for you to look up a submission if the message doesn’t say “meme”. … Read more

SyntaxError: unexpected EOF while parsing

The SyntaxError: unexpected EOF while parsing means that the end of your source code was reached before all code blocks were completed. A code block starts with a statement like for i in range(100): and requires at least one line afterwards that contains code that should be in it. It seems like you were executing your program line by … Read more