试着印希伯来文,但印其他字符Python27

2024-04-26 01:14:56 发布

您现在位置:Python中文网/ 问答频道 /正文

我试着用我在网上找到的ocde把希伯来文字母组合起来,但结果是: 我无法正确打印希伯来文字母,我认为这是一个编码问题。。 使用python 2.7.15 代码:

# -*- coding: utf-8 -*-
your_list = 'אבגדהוזחטיכלמנסעפצקרשת '
complete_list = []
max_length = 2
a = []
print 'Starting find combinations for', max_length, 'letters, with the         chars"'+your_list+'"'
for current in xrange(max_length):
a = [i for i in your_list]
for y in xrange(current):
    a = [x+i for i in your_list for x in a];
complete_list = complete_list + a
for x in complete_list:
    print x.decode("utf-8")

还有控制台:

    Starting find combinations for 2 letters, with the chars"אבגדהוזחטיכלמנסעפצקרשת "
××
ミ×
××
‘×
××
’×
××
“

这只是一部分


Tags: theinforyourwithfindlengthmax
1条回答
网友
1楼 · 发布于 2024-04-26 01:14:56

使用^{}

import itertools

your_list = 'אבגדהוזחטיכלמנסעפצקרשת '

for p in itertools.product(your_list, your_list):
    print(",".join(p))

输出:

א,א
א,ב
א,ג
א,ד
א,ה
א,ו
א,ז
א,ח
א,ט
א,י
...

顺便说一句,Python 2 will retire in ...

相关问题 更多 >