Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否有 Python 函数可以将屏幕/控制台输入(例如 10**8)转换为整数 100000000。这样可以避免键入所有可能出错的零。
这是两种可能的解决方案:
inp = "10**8" a = eval(inp) #don't use eval for untrusted input b = int(inp.split("**")[0])**int(inp.split("**")[1]) print (10**8 == a == b)
输出:
真的