python回车不能换行的解决办法:首先创建写入方法;然后将selenium的脚本运行结果写入【test_result.log】文件中;**后在写入参数str后加【 】则会在每次完成写入后,自动换行到下一行。
python回车不能换行的解决办法:
现在需要一个写文件方法,将selenium的脚本运行结果写入test_result.log文件中
首先创建写入方法
def write_result(str):
writeresult=file(r'D:eclipse4.4.1 scriptmy_seleniummodel est_result.log','a+')
str1=writeresult.write(str+'
')
writeresult.close()
return str如上str1=writeresult.write(str+' ') 中写入的文件默认在一行显示,当调用此方法后,每次都会在该文件第一行写入
在写入参数str后加“ ”则会在每次完成写入后,自动换行到下一行,下次写入时便会在下一行写入
相免费学习推荐:python视频教程
以上就是python回车不能换行怎么办的详细内容,更多请关注考高分网其它



