我试图从我的JavaScript代码调用Python中的函数.我使用了这里解释的代码,但它对我不起作用.
这是我的JS代码:
<!DOCTYPE html>
<body>
<script type="text/javascript" src="d3/d3.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script>
text ="xx";
$.ajax({
type: "POST",
url: "~/reverse_pca.py",
data: { param: text}
}).done(function(o) {
console.log(data);
console.log(text);
});
Run Code Online (Sandbox Code Playgroud)
Python代码:
import csv
from numpy import genfromtxt
from numpy import matrix
def main():
...
return x
if __name__ == "__main__":
x=main()
return x;
Run Code Online (Sandbox Code Playgroud)
你知道它有什么问题吗?
我绘制一个矩形,我需要将这个矩形分成两部分.我试图使用线来划分它,但我不知道为什么我看不到这条线.
Rectangle rect = new Rectangle();
rect.Fill= Colors.Blue;
rect.Width=100;
rect.Margin = new Thikness (0,40,0,0);
grid.Children.Add(rect);
Line line = new Line();
line.Stroke = Colors.Black;
line.StrokeThickness=1;
line.X1=2;
line.X2=7;
line.Y1=41;
line.Y2=41;
grid.Children.Add(line);
Run Code Online (Sandbox Code Playgroud)
你知道我怎么能在矩形上添加一条线?