【发布时间】:2018-02-26 04:04:47
【问题描述】:
我已经尝试了很多设置并搜索了一段时间。我会试着总结一下我的问题。
我有一个名为 script.py 的文件。
在这个 script.py 里面我有这样的东西:
import math
import numpy as np
from numpy import matrix
#Inserting variables:
A=float(input("insert position 1: "))
K=float(input("insert position 2: "))
#Doing some math:
a1=A*K
a2=A/K
#Defining a funtion:
def solve(var1,var2)
#This function uses numpy and math and handles matrices.
#I am not putting it to save space and make my problem clear
#Calling the funtion:
solve(a1,a2)
print (solve)
#The values of a1 and a2 are the once I calculated previously
然后我按“运行模块”运行script.py,它显示:
>> insert position 1:
>> insert position 2:
我插入值,然后它显示:
<function solve at 0x000000000A0C1378>
如何让python shell直接显示结果?
目前为了得到结果我需要在 python shell 中输入
>> solve(a1,a2)
得到我的结果。
我希望我能够让我的问题变得简单明了。谢谢。
【问题讨论】:
标签: python python-3.x function numpy