A program I wrote wasn't printing anything when I executed it out of the terminal, so I tried the ran the following code
import sys
#!/usr/bin/python
def main(argv):
print "hell0\n"
sys.stdout.flush()
this is the terminal why is it not printing out hello. Is the main function even running?
Python does not automatically call main() (and you'll need to use the sys library to get argv).
#!/usr/bin/python
import sys
def main():
print "hell0\n"
main()
You didn't call main
anywhere, you've only defined it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With