我有一个C应用程序,在这个应用程序中,我使用重音字符运行Python脚本(ÀÈÏ等)。在
为此,我使用铁蟒。我的脚本可以很好地与python3.5.1(在空闲状态下)一起工作,但是由于Iron Python将其作为python2.7脚本执行,所以我的脚本无法工作。在
我读到编码应该是Unicode而不是Utf8,但是我在Google上找到的唯一相关的东西就是在字符串前面加上u(即text=u'theText'),或者使用Unicode(Unicode()(即Unicode(theText))。他们两个都没用。在
我从中得到错误:'Microsoft.Scripting.SyntaxErrorException'
铁蟒.dll. 在
更具体:Non-ASCII character '\xc3' in file pathToScript/cesar.py on line 13, but no encoding declared
。在
下面是我的Python脚本的简化版本,它执行Caesar密码“加密”:
class WhateverName:
def index(self, lettre, texte):
for k in range(len(texte)):
if (lettre == texte[k]):
return k
return -1
def rotateLetters(self, text , number):
letters = 'abcdefghijklmnopqrstuvwxyzéèëêàâöôçîïü!?.,'
lettersRotation = letters[number:] + letters[:number]
newText = ''
for letter in text:
newText = newText + lettersRotation[self.index(letter, letters)]
return newText
在我的C应用程序中,我会这样称呼它:
^{pr2}$那么,在python2.7环境(Iron Python)中,如何使Python脚本中的字母变量工作?在
目前没有回答
相关问题 更多 >
编程相关推荐