擅长:python、mysql、java
<p>你可以用像</p>
<pre><code>af = 132
color = subprocess.run(['tput', 'setaf', f'{af}'], capture_output=True).stdout.decode('utf-8')
sgr0 = subprocess.run(['tput', 'sgr0'], capture_output=True).stdout.decode('utf-8')
print(f'{color}HELLO{sgr0}')
</code></pre>
<p>可以使用<a href="https://gist.github.com/dtmilano/4055d6df5b6e4ea87c5a72dc2d604193" rel="nofollow noreferrer">https://gist.github.com/dtmilano/4055d6df5b6e4ea87c5a72dc2d604193</a>查看颜色的值(在本例中为前景)</p>