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.+-"