Apr-01-2017, 10:45 AM
If you want it in one line it sounds like you would be using a list comprehension for it. Why not just use the conditional part of the list comprehension?
if [part for part in filename.split('/') if part == '..']: raise UnsafeFileError(filename)It's kind of inefficient, but it works.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures