str = '123a'. is_int = True. try: # convert to integer. int(str). except ValueError: is_int = False. # print result. if is_int: print('Integer value').
確定! 回上一頁