re.sub not replacing all occurrences

前端 未结 4 1986

I\'m not a Python developer, but I\'m using a Python script to convert SQLite to MySQL

The suggested script gets close, but no cigar, as they say.

The line g

4条回答
  •  耶瑟儿~
    2021-01-02 02:30

    The first match you see is ,'t',. Python proceeds starting with the next character, which is ' (before the second t), subsequently, it cannot match the ([^']) part and skips the second 't'.

    In other words, subsequent matches to be replaced cannot overlap.

提交回复
热议问题