python调用主函数,具体方法如下:
import datetimeprint('Hello World!')print('Time is ', datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S %A'))def main():print('this message is from main function')if __name__ == '__main__':main()
import datetime
print('Hello World!')
print('Time is ', datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S %A'))
def main():
print('this message is from main function')
if __name__ == '__main__':
main()