Sanitize data input | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Sanitize data input

Hi, I want to sanitize some data input. I would prefer a whitelisting function- so only approved input. I am guessing I could do this with a function that compares characters to my whitelist and rejects all "non approved characters", but I would rather have a module or a Regular Expression that has an allowed list of characters. basically I want ro use a standard module...what do you guys use?

27th Apr 2017, 12:53 PM
David C
1 Answer
0
I didn't understand very well, but If you want to compare two list is very easy. You coul use something like: if x in whitelist: x is an element of the other list. you need to pass x values in a loop. for example: loop de list1 that extract x elemet is x in whitelist? (whitelist is a list with whitelis elemets)
1st May 2017, 11:57 AM
Ambrosio
Ambrosio - avatar