import math
input_str = "3.1415926_5358979"
cleaned_str = input_str.replace("_", "")
print(f"整理后的数字: {cleaned_str}")
length = len(cleaned_str)
print(f"数字总长度(含小数点): {length}")
digits_only = cleaned_str.replace(".", "")
print(f"纯数字部分: {digits_only}")
print(f"纯数字位数: {len(digits_only)}")
pi_str = str(math.pi)[:len(cleaned_str)]
print(f"标准圆周率前{len(cleaned_str)-1}位小数: {pi_str}")
if cleaned_str == pi_str:
print("✅ 输入的数字与标准圆周率对应位数完全匹配")
else:
print("❌ 输入的数字与标准圆周率对应位数不匹配")
for i, (c1, c2) in enumerate(zip(cleaned_str, pi_str)):
if c1 != c2:
print(f"差异位置 {i}: 输入为'{c1}', 标准π为'{c2}'")