jython 2.5无法打印字符串

时间:2012-12-10 02:43:34

标签: jython

Jython 2.5.2 (Release_2_5_2:7206, Mar 2 2011, 23:12:06)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_20
Type "help", "copyright", "credits" or "license" for more information.
>>> print 3
3
>>> print "3"
...

我尝试了Jython 2.2.1版本,没关系,但问题仍然存在于Jython 2.7b1版本中:

Jython 2.7b1 (default:ac42d59644e9, Feb 9 2013, 15:24:52)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_39
Type "help", "copyright", "credits" or "license" for more information.
>>> print 'ab'
...

3 个答案:

答案 0 :(得分:0)

我试过这个,我的版本效果很好:

Jython 2.5.3 (2.5:c56500f08d34+, Aug 13 2012, 14:48:36)
[Java HotSpot(TM) Client VM (Oracle Corporation)] on java1.7.0_09
Type "help", "copyright", "credits" or "license" for more information.
>>> print 3
3
>>> print "3"
3

我使用Jython和Java的更新版本,但我认为这不是问题。尝试在print文件中保存这些print_test.py语句,并通过jython print_test.py和CPython python print_test.py执行。向我们展示结果。

答案 1 :(得分:0)

同样的问题:

Jython 2.5.2 (Release_2_5_2:7206, Mar 2 2011, 23:12:06)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_02
Type "help", "copyright", "credits" or "license" for more information.
>>> print 'hi'
...

看起来只是2.5.2的错误

答案 2 :(得分:0)

也许这是特定于操作系统或机器环境,因为它在2.7.0的Windows上表现得很好,并且已经看到它在以前的版本中运行。

Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_51
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.platform()
'Java-1.7.0_51-Java_HotSpot-TM-_64-Bit_Server_VM,_24.51-b03,_Oracle_Corporation-on-Windows_7-6.1-amd64'
>>> print 3
3
>>> print '3'
3
>>> print "3"
3

什么是底层操作系统以及如何调用控制台?您是否有打印以外的构造问题或者没有引用带引号的字符串?