feat: add string_format_test.py
This commit is contained in:
13
string_format_test.py
Normal file
13
string_format_test.py
Normal 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))
|
||||
Reference in New Issue
Block a user