擅长:python、mysql、java
<p>FITS标准不处理unicode。在astropy.fits中,当您编写时,它将尝试编码为ASCII。当你阅读一个FITS文件时,有一种神奇的方法可以让ASCII <code>bytes</code>看起来像<code>str</code></p>
<p>简而言之,如果您试图直接处理存储在FITS中的数据,则需要使用<code>bytes</code>。例如:</p>
<pre><code>In [8]: s = np.array(['hello', 'world'])
In [9]: np.char.encode(s, 'ascii')
Out[9]: array([b'hello', b'world'], dtype='|S5')
</code></pre>