Pycharm 简明教程

Pycharm - Console

PyCharm 拥有一个功能齐全的 Python 控制台,其中提供了完整的代码补全功能,可在选项菜单 Tools → Run Python Console. 中使用

PyCharm has a full-fledged Python console with full code completion which is available in the option menu Tools → Run Python Console.

run console

考虑在上一章中提到的代码,如下所示 −

Consider the code which was mentioned in the previous chapter, as shown below −

message = 'GIEWIVrGMTLIVrHIQS' #encrypted message
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for key in range(len(LETTERS)):
   translated = ''
   for symbol in message:
      if symbol in LETTERS:
         num = LETTERS.find(symbol)
         num = num - key
         if num < 0:
            num = num + len(LETTERS)
         translated = translated + LETTERS[num]
      else:
         translated = translated + symbol
   print('Hacking key #%s: %s' % (key, translated))

现在,让我们借助控制台运行代码,以执行脚本以获得所需的输出,如下所示。

Now, let us run the code with the help of console to execute the script for getting the desired output, as shown below.

desired output

你可以观察到输出,如下所示 −

You can observe the output as shown below −

final output