字符串格式错误
尝试了各种字符串格式,但未找到结果
msg.body = '''Dear admin,
You requested that your password be reset.
Please visit the link below or copy and paste it into your browser to create a new password.%s''' \
%url_for('.get_resetpassword',token=token,_external=True)%'''
Thank you,
Team
'''
builtins.TypeError TypeError:不是所有在格式化字符串期间转换的参数
答案 0 :(得分:0)
稍后应使用字符串格式:
for(int i=0;i<ja.length();i++){
String proj_id = ja.getJSONObject(i).getString("project_id");
Set<Object> sets = new HashSet<>();
if (!(sets.contains(proj_id))) {
sets.add(proj_id);
}
Iterator<Object> itr=sets.iterator();
while(itr.hasNext()) {
JSONArray jarr=new JSONArray();
for (int j=0;j<sets.size();j++) {
System.out.println("i="+i);
System.out.println("j="+j);
List emplist=empservice.getEmpByProjId(proj_id);
JSONObject finalobj=new JSONObject();
finalobj.put("project_id", proj_id);
finalobj.put("emp-proj", emplist);
jarr.put(finalobj);
itr.next();
}
jsonObject.put("data", jarr);
System.out.println("list of jarr obj : "+jarr);
}
} //for
因此您无需打扰任何事情。
或使用:
msg.body = '''Dear admin,
You requested that your password be reset.
Please visit the link below or copy and paste it into your browser to create a new password.%s
Thank you,
Team
'''%url_for('.get_resetpassword',token=token,_external=True)
答案 1 :(得分:0)
这可能有效。
url_for="YOUR INPUT"
a='''Dear admin,
You requested that your password be reset.
Please visit the link below or copy and paste it into your browser to create a new password.%s
Thank you,
Team.'''% (url_for)
打印(a)