You've successfully subscribed to ムえのBLOG
Great! Next, complete checkout for full access to ムえのBLOG
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Python ticks 100

Python ticks 100

. 1 min read
def str_to_num(s:str):
	s = s.replace('\n', '').replace('\t', '').replace('\r', '').replace(' ', '')
	try:
		v = eval(s)
	except:
		return False, s
	else:
		try:
			v_f = eval(str(type(v)).split('\'')[1]+'(\''+s+'\')')
			if v_f == v and type(v) in [int, float, complex]:
				return True, v
		except:
			return False, s
		else:
			return False, s


本站总访问量