前端采用vue+axios 后端采用spring boot restful 问题: 前端get 请求需要传递array 字段值 后端由于tomcat 版本问题,不支持url接受特殊字符包括 [] {} 等. Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986 百度搜索到的方案 大都是让 采用字符串形式传参 或者 urlencoding 或者
在Python环境下获取指定后缀文件列表的方式. 来源stackoverflow 这里简单以*.txt的作为例子. 使用glob(推荐) import glob, os os.chdir("/mydir") for file in glob.glob("*.txt"): print(file) 简单实用os.listdir import os for file in os.listdir("./mydir"): if file.endswith(
# Author:mologa k = "ab" for i in k: with open('%s.txt'%i,'w') as f: f.write("hello") f.close() 这样就可以创建a.txt.b.txt.c.txt.d.txt四个文件: ##### *知识点: `open('%s.txt'%i,'w')`
一.函数的初始 比如python没有len()方法,如何求字符串的长度使用for循环 s = 'fdshfeigjoglfkldsja' count = 0 for i in s: count += 1 print(count) 执行输出: 19 列表呢? li = [1,2,3,'a','b','c','ask'] count = 0 for i in li: count += 1 print(count) 执行输出: 7 如果是字典呢? 再把上面的代码贴一遍? 以上可以看出2点 1.重复代码