我想确定文件是否为空并且存在,但是当我使用Python和shell时,我发现文件内容为空,但是大小为20?为什么会这样
[xxxx@node1 xxxx]$ python
Python 2.7.15 (default, Jan 18 2019, 21:06:25) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
>>> import os
enter code here
>>> os.path.getsize("SRR2131549_clean.fq.gz")
20
>>> os.stat("SRR2131549_clean.fq.gz").st_size
20
>>> with open("SRR2131549_clean.fq.gz") as reader:
... print(reader.read())
...
>>>
[xxxx@node1 xxxx]$ cat SRR2131549_clean.fq.gz
[xxxx@node1 xxxx]$ zcat SRR2131549_clean.fq.gz
[xxxx@node1 xxxx]$