Reputation: 5821
Sorry for the vague title, but I am unsure how else to explain it. Running the command in terminal:
python --version
Outputs:
Python 3.9.10
When I try to run my main.py
file using the command: python main.py
or python3 main.py
nothing outputs. I am new to Python and this was just working but I restarted my computer and now I cant get any of my Python scripts to output or run.
This is all that my main.py
is:
def main():
print("hello world")
Does anyone have any ideas?
Upvotes: 1
Views: 400
Reputation: 31
You need to call the method. Just defining a method is not enough to run it.
Try this:
def main():
print("hello world")
main()
Upvotes: 1
Reputation: 3730
You have to call the function:
def main():
print("hello world")
main()
Upvotes: 3