用write!和writeln!即可。 write! ( mut writer , " Factorial of {} = {} " , num , factorial ); writeln!就是在最后自动加一个换行。 原文:https://stackoverflow.com/questions/3247
用write!和writeln!即可。
write!(&mut writer, "Factorial of {} = {}", num, factorial);writeln!就是在最后自动加一个换行。
原文:https://stackoverflow.com/questions/32472495/how-do-i-write-a-formatted-string-to-a-file