尝试在Windows上运行这样简单的程序(它在我的Mac OSX上工作得很好),这里是程序和错误消息,当光标在// same as your code
TermFilterBuilder family_filter_1 = ...;
FilteredQueryBuilder qbuilder = ...;
SearchRequestBuilder search = ...;
// build the range filter
RangeQuery ageRange = QueryBuilders.rangeQuery("age")
.from(18).to(40).includeLower(false).includeUpper(false);
// build the terms sub-aggregation
TermsAggregation age = AggregationBuilders.terms("age")
.field("age")
.size(0)
.order(Terms.Order.count(true));
// build the filter top-aggregation
FilterAggregationBuilder youngAge = AggregationBuilders
.filter("young_age")
.filter(ageRange)
.subAggregation(age);
search.addAggregation(youngAge);
停止时,会有一个警告说预期结束语句。我是否需要在Windows上对Python做一些特别的事情?
print a
错误:
if __name__ == "__main__":
a=[1,2,3]
print a
提前谢谢,
林
答案 0 :(得分:4)
在python 3.4中,您需要使用print(a)
在python 2.7中print a