为什么我在最后一行收到语法错误? [英] Why am I getting a syntax error on the last line?

查看:96
本文介绍了为什么我在最后一行收到语法错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我直接从我的教科书中复制了这个,但它不起作用。任何帮助将不胜感激。



  def  main():

infile = open(' progbday.txt'' r'

file_contents = infile.read()

infile.close()

print (file_contents)

main()





我尝试了什么:



我尝试移动缩进但是idk。我完全无能为力

解决方案

另见 Python教程 - Python 3.4.5文档 [ ^ ]。

I copied this straight from my textbook, but it doesn't work. Any help would be greatly appreciated.

def main() :

		infile = open('progbday.txt', 'r')

		file_contents = infile.read()

		infile.close()

		print(file_contents)

main()



What I have tried:

I tried moving the indent around but idk. I'm completely clueless

解决方案

See also The Python Tutorial — Python 3.4.5 documentation[^].


这篇关于为什么我在最后一行收到语法错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆