简体   繁体   English

使用Jython将数据结构从Python传递到Java

[英]Passing data structures from Python to Java using Jython

This seems like a really basic question, but I haven't been able to find the answer... 这似乎是一个非常基本的问题,但我一直找不到答案...

I have a Java web app built with GWT. 我有一个用GWT构建的Java Web应用程序。 It needs to call some code that's written in Python. 它需要调用一些用Python编写的代码。 I've followed the tutorial and written an object factory for the methods that use simple data types. 我已按照该教程进行操作,并为使用简单数据类型的方法编写了对象工厂。

However, one of the python methods includes this code: 但是,其中一种python方法包含以下代码:

titles_ranked = []
 for i in range(len(sort_index)):
     doc['title'] = self.titles[sort_index[i]][0][0]
     doc['role'] = self.RDS[:,sort_index[i]].toarray().reshape(6,)
     titles_ranked.append(doc.copy())
 return titles_ranked

How can I represent this in the Java wrapper class so that I can access it from Java? 如何在Java包装器类中表示这一点,以便可以从Java访问它? Alternatively, do I need to use some other data structure? 另外,我是否需要使用其他数据结构?

我知道了,这是一个PyArray。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM