下面的代碼拋出編碼錯誤:蟒蛇編碼錯誤
import os
path = u"E:\\project\\robot_framework\\第一個測試項目\\logs\\log-20170330-094807.html"
os.system("scp "+path+" [email protected]:/root/jenkins/workspace/RobotFramework/logs/")
錯誤消息:
回溯(最近通話最後一個):
File "E:\project\robot_framework\PythonDemo\src\try.py", line 12, in <module>
os.system("scp "+path+" [email protected]:/root/jenkins/workspace/RobotFramework/logs/")
UnicodeEncodeError: 'ascii' codec can't encode characters in position 31-37: ordinal not in range(128)
[這篇文章可能幫助你](http://stackoverflow.com/questions/33294213/how-to-decode-unicode-in-a-chinese-text),好像你需要編碼和解碼它第一。 –
@PikeD。我試過編碼()解碼()unicode(),但沒有幫助 –