1 回答

TA貢獻(xiàn)1824條經(jīng)驗(yàn) 獲得超5個(gè)贊
我不認(rèn)為 PyCharm 有這個(gè)功能,因?yàn)樗粫?huì)真的是 Python。您可以執(zhí)行以下操作:
在first_script.py:
from second_script import my_function
# define certain variables with given some input
x = input()
y = input()
# ...
# call 'my_function', which is defined in 'second_script.py'
result = my_function(x, y)
在文件中second_script.py:
# define a function to process the variables and return something
def my_function(x, y):
# process the variables
z = x + y
# and return the result
return z
這兩個(gè)文件first_script.py都second_script.py應(yīng)該在同一個(gè)目錄中。然后你必須配置 PyCharm 以便它執(zhí)行first_script.py。
添加回答
舉報(bào)