Python Regex replace

前端 未结 6 1383
野性不改
野性不改 2021-02-05 05:01

Hey I\'m trying to figure out a regular expression to do the following.

Here is my string

Place,08/09/2010,\"15,531\",\"2,909\",650

I

6条回答
  •  耶瑟儿~
    2021-02-05 05:38

    new_string = re.sub(r'"(\d+),(\d+)"', r'\1.\2', original_string)
    

    This will substitute the , inside the quotes with a . and you can now just use the strings split method.

提交回复
热议问题