我试图通过以下代码从txt文件中读取sql脚本:
with open ("Mypath\\myfile.txt", "r") as myfile:
data = myfile.read().replace('\n','')
我收到此错误消息:
IndentationError: expected an indented block
有什么想法吗?
答案 0 :(得分:2)
你必须正确缩进:
with open("Mypath\myfile.txt", "r") as myfile:
data = myfile.read().replace('\n', ' ')