feat: add string_format_test.py

This commit is contained in:
2025-09-06 23:19:36 +08:00
parent bd0e038794
commit 43147922c5

13
string_format_test.py Normal file
View File

@@ -0,0 +1,13 @@
#!/usr/bin/env python3
if __name__ == "__main__":
print(f"Price {1:.2f}")
print(f"Price {3.1415:.2f}")
print(f"Price {300000000.1415:,.2f}")
print(f"Value hex {1000:x}")
print(f"Value hex {1000:X}")
print(f"Value hex {1:.2%}")
print("Price {0:,.2f}, count {1}".format(100, 100))
print("Price {price:,.2f}, count {count}".format(price=100, count=100))