About 402,000 results
Open links in new tab
  1. Python – Swap commas and dots in a String | GeeksforGeeks

    Dec 27, 2024 · In this article, we’ll explore how to swap commas and dots in a string in Python. str.translate () that allows for character substitution within a string using a translation table. It …

  2. python - How to swap comma and dot in a string - Stack Overflow

    Mar 13, 2015 · Use the str.translate() method instead: from string import maketrans # Python 2. maketrans = str.maketrans # Python 3. price = price.translate(maketrans(',.', '.,')) This'll swap …

  3. Python: Swap comma and dot in a string - w3resource

    Apr 19, 2025 · Write a Python program to swap every comma with a dot and every dot with a comma in a given string. Write a Python program to implement a function that iterates through …

  4. How to Swap Commas and Dots in a String in Python? - Python

    Jan 29, 2025 · Learn how to swap commas and dots in a string in Python using `str.replace()`, `translate()`, and `re.sub()`. This guide includes examples for easy understanding.

  5. Write a Python program to swap comma and dot in a string

    Aug 13, 2021 · You can Swap commas and dots in a String using replace() function or Using maketrans and translate() functions in Python.

  6. +Python | Swap commas and dots in a String - python tutorials

    Oct 6, 2019 · In this blog post, we’ll explore a Python program that swaps commas and dots in a given string. The program will take a string as input, swap occurrences of commas (,) with dots …

  7. Write a Python program to swap comma and dot in a string

    This program is swapping the comma and dot in a string. The string "23,2000.00" is assigned to the variable "val". The original string is then printed to the console using the "print" function …

  8. Python3 Program for Swap characters in a String

    Sep 5, 2024 · # Python Program to Swap characters in a String def swapCharacters (s, B, C): N = len (s) # If c is greater than n C = C % N # Converting string to list s = list (s) # loop to swap ith …

  9. Write a Python program to swap commas & dots in string.| Top 100 Python ...

    Nov 1, 2023 · This Python program is designed to swap commas and dots in a given string. It achieves this by using the str.replace() method. The steps involved are as foll...

  10. python - Replace multiple fullstops with single fullstop - Stack Overflow

    Dec 5, 2015 · You can do this by using a regex and substitute the occurrences of multiple dots by only a single one as shown below: Giving you: In addition I'll give you a small explanation …

Refresh