【发布时间】:2019-03-08 02:05:05
【问题描述】:
我正在使用 pycharm 到 2018.3.4 来开发 python 脚本,我对这种语言还是很陌生,我通常编写 PowerShell 代码。我有一个关于调试的问题。以这段未完成的代码为例。
#! python3
# phoneAndEmail.py - Finds phone numbers and email addresses on the clipboard.
import pyperclip, re, sys
phoneRegex = re.compile(r'''(
(\(?([\d \-\)\–\+\/\(]+)\)?([ .-–\/]?)([\d]+))
)''', re.VERBOSE)
mailRegex = re.compile(r'''(
\w+@\w+\.\w+
)''', re.VERBOSE)
text = pyperclip.paste()
def getMatches(text, regex) :
return regex.findall(text)
Emails = getMatches(text,mailRegex) #I want to play with this variable at runtime
phone = getMatches(text,phoneRegex)
我正处于我想在运行时分析变量 Emails 的阶段。所以我设置了一个断点,可以查看变量的内容就好了。但是我也想运行一些方法并在运行时使用它们的输入参数。有人知道这是怎么可能的吗?如果使用另一个 IDE 可以做到这一点,那么这也可以。
【问题讨论】:
标签: python-3.x debugging