from greeting import say_hello from greeting import print_morning # 実行 say_hello('Bob') print_morning()
x = 5 y = 0 try: z = x / y except: #traceback.print_exception() print "Exception" finally: print "All Done." def ask(): while True: try: i = int(raw_input("input an integer: ")) except: print "An error occurred! Please, try again!" continue else: print "Thank you, your number squared is: {0}".format(i ** 2) break #ask() # module import greeting.say_hello() print 'sum: ', my_module.my_sum(1, 2)
def main(): # Hàm chính được gọi nếu test_greeting được người dùng chạy say_hello("Cuong") print(add(10, 2)) print(minus(10, 2))
import greeting greeting.say_hello("이승민") greeting.say_goodbye("이승민")
import greeting print("File1 __name__ = %s" % __name__) avar = 10 if __name__ == "__main__": print("File1 is being run directly") else: print("File1 is being imported") greeting.say_hello('HI')
import greeting greeting.say_hello("junyeop") greeting.say_goodbye("oh")