题解 | #进制转换#
进制转换
https://www.nowcoder.com/practice/8f3df50d2b9043208c5eed283d1d4da6
import sys def toDecimal(hex_str, base=16): if '0x' in hex_str: result = int(hex_str, base) return result else: return '' if __name__ == '__main__': hex_ori = sys.stdin.readline().strip() result = toDecimal(hex_ori) print(result)