list1=['-32.52%', '-1.71', '-2.03%', '-1.17', -54.5586, '-12.99', '27.27%', '20.5531%', '31.6638%']
list1=[str(x) for x in list1]
for i,item in enumerate(list1):
if '%' in item:
percentage_float = float(item.rstrip('%')) # 去掉百分号并转换为浮点数
rounded_percentage = round(percentage_float, 2) # 保留两位小数
formatted_percentage = f'{rounded_percentage:.2f}%' # 格式化为带有百分号的字符串
list1[i]=formatted_percentage
else:
list1[i]= round(float(item), 2)
print(list1) # 输出格式化的百分比字符串
05-15
3308

12-06
1338

05-17
5141

09-01
1万+
