python代碼
textarea上傳數據過濾非數字類數據並生成列表
[ x for x in request.POST.get('textarea').split("\r\n") if x != '' and all(c in "0123456789." for c in x) ]
"0123456789." 定義爲數字定義(如果需要正負號) "0123456789.+-"
python代碼
textarea上傳數據過濾非數字類數據並生成列表
[ x for x in request.POST.get('textarea').split("\r\n") if x != '' and all(c in "0123456789." for c in x) ]
"0123456789." 定義爲數字定義(如果需要正負號) "0123456789.+-"
class MetaCls(type): def __new__(cls, *args, **kwargs): print("in MetaCls") # return super(Meta