在Python3中打印功能 [英] print function in Python3

查看:160
本文介绍了在Python3中打印功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我使用的功能如下:

  input = open('test.txt','r')
输入行:
print(line,end ='')

Eclipse报告语法错误

  print(line,end ='')

,它表明

 检测元组时的语法错误。 
print发现于:builtins
print(value,...,sep ='',end ='\\\
',file = sys.stdout)

但是,程序运行正常。



有什么可以做的,错误符号或是否有更好的解决方案?

解决方案

将语法版本更改为Python 3.x。





(上图来自 http://pydev.org/manual_101_project_conf2.html ) p>

I am currently using Python3.2 in Eclipse JavaEE Indigo.

I use the function print as follows:

input = open('test.txt', 'r')
for line in input:
    print(line, end='')

Eclipse reports a syntax error with

print(line, end = '')

and it suggests that

Syntax error while detecting tuple.
print Found at: builtins
print(value, ..., sep=' ', end='\n', file=sys.stdout)

However, the program runs perfectly.

Is there anything I can do to remove the error symbol or is there any better solution for this problem ?

解决方案

Change grammar version to Python 3.x.

(Above image comes from http://pydev.org/manual_101_project_conf2.html)

这篇关于在Python3中打印功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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