我正在尝试通过以下代码从TXT文件读取SQL脚本:
with open ("Mypath\myfile.txt", "r") as myfile:
data = myfile.read().replace('n','')
我收到此错误消息:
IndentationError: expected an indented block
有什么想法?
您必须正确缩进:
with open("Mypathmyfile.txt", "r") as myfile:
data = myfile.read().replace('n', ' ')