如何读取 gzip:'GzipFile' 对象没有属性 'extrastart''

How to read gzip: 'GzipFile' object has no attribute 'extrastart''

我想阅读 gzip 并更新内容。

但是,我得到了错误

'AttributeError: 'GzipFile' object has no attribute 'extrastart''.

import gzip                                                 

with gzip.open("PhoneWindowManager.java.gz", "w+") as file: 
    for line in file:                                       
        if "setHdmiPlugged" in line:                        
            call = "#setHdmiPlugged"                        
            if call in line:                                
                continue                                    
            else:                                           
                print line                                  
                break   

extrastart 仅在模式以 'r'、

开头时设置
with gzip.open("PhoneWindowManager.java.gz", "r") as file://change "w+" to "r+"