Efficient way to search for invalid characters in python

前端 未结 9 1448
萌比男神i
萌比男神i 2021-01-07 03:10

I am building a forum application in Django and I want to make sure that users dont enter certain characters in their forum posts. I need an efficient way to scan their whol

9条回答
  •  灰色年华
    2021-01-07 03:43

    If efficiency is a major concern I would re.compile() the re string, since you're going to use the same regex many times.

提交回复
热议问题