Jupyter用阿拉伯和字母数字元素错误地显示Python列表 [英] Jupyter misdisplying Python lists with Arabic and alphanumeric elements

查看:106
本文介绍了Jupyter用阿拉伯和字母数字元素错误地显示Python列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Jupyter(包括Classic和JupyterLab)中遇到了一个显示问题,该列表包含阿拉伯字符串元素和拉丁字母数字字符串元素.例如,如果您运行:

I am running into a display problem in Jupyter (both Classic and JupyterLab) for lists that include Arabic string elements and Latin Alphanumeric string elements. For example, if you run:

en = '7X'
print (en)
ar = 'عربي'
print (ar)
print ([en, ar])
print ([ar, en])

这是您得到的:

很明显,阿拉伯语是第一个元素,Jupyter遵循RTL对齐方式,在右边首先显示ar元素,但是我不知道为什么'X'从字母数字元素跳出或如何解决.

Obviously, where Arabic is the first element, Jupyter follows an RTL alignment displaying the ar element first on the right, but I don't know why the 'X' jumps from the alphanumeric element or how to fix that.

顺便说一下,这是Spyder打印出相同代码的方式:

By the way, this is how Spyder prints out the same code:

推荐答案

单击打印输出以将其切换到正确的位置.

Click on the print out to switch it to the correct position.

>>> print([ar,en])
['عربي', '7X']
#Click Here^

我认为这是一个错误,仅适用于阿拉伯语.我用中文毫无问题地试了一下.我将尝试对此进行更多研究并更新此答案.

I believe this is an error that only applies to Arabic. I tried it with Chinese without problem. I'll try to do more research on it and update this answer.

这篇关于Jupyter用阿拉伯和字母数字元素错误地显示Python列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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