簡體   English   中英

錯誤:編碼是此函數的無效關鍵字參數

[英]Error: Encoding is an invalid keyword argument for this function

我一直收到這個錯誤:

TypeError: 'encoding' is an invalid keyword argument for this function.

當我運行我的代碼時:

import re

f = open("/home/file/abc.sql", 'rt', encoding='latin-1')
source=f.read()

with open("/home/file/samp0l9.sql","w") as output:
    output.write(re.sub(r'(TBLPROPERTIES \(.*?\))', r'\1;', f, flags=re.DOTALL))

關於為什么會這樣的任何想法? 文件里面只是一些文字。

Python 3

open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None)

VS:

Python 2.7

open(name[, mode[, buffering]])

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM