擅长:python、mysql、java
<p>如果您了解一些Bash脚本,您会发现<em>echo'$HOME'</em>将打印$HOME letter,而不是$HOME中的实际值,我的意思是/HOME/user/。在</p>
<p>然而,和Python一样,print函数将被解释为双引号和单引号,这是同一件事。如果没有引号或不必使用双引号的句子,我就用“”。不过,你仍然可以用“\”来实现。在</p>
<p>示例-</p>
<pre><code>print 'hello\nworld' -> hello
world
print "hello\nworld" -> hello
world
</code></pre>
<p>以及</p>
^{pr2}$
<p>如果有时,我需要原始输出,我不会使用打印或尝试其他解决方法。在</p>
<p>另外,如果必须使用print函数输出原始字符串。我就用这个-</p>
<pre><code>print repr("hello\n\tworld\\") -> 'hello\n\tworld\\'
</code></pre>
<p>不过,这要看你的情况。在</p>
<p>请随意编辑/建议,以便更好地改进此回复。在这个答案中,我可能会犯很多错误和错误的信息。在</p>