Skip to content

Instantly share code, notes, and snippets.

@DevloperHS
Last active July 18, 2023 15:33
Show Gist options
  • Select an option

  • Save DevloperHS/5f882ab1a4895dc5144fd658717642a5 to your computer and use it in GitHub Desktop.

Select an option

Save DevloperHS/5f882ab1a4895dc5144fd658717642a5 to your computer and use it in GitHub Desktop.
Add a thousand separator in python
num1 = 3_000_000_00
num2 = 3_0
result = num1*num2
print(result)
num1 = 3_000_000_00
num2 = 3_0
result = num1*num2
print(result) # print without seperator
# print code with , and _ as separator, default value - 3 digits
print(f"{result:,}")
print(f"{result:_}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment