Binding binding = new Binding();
binding.Source = department; // <--
binding.Path = new PropertyPath("Name"); //<-- "Name" refers to a property of the Department class
binding.Mode = BindingMode.TwoWay;
binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
我无法获得打印输出。我希望y中的整行与x中的单词匹配。
答案 0 :(得分:2)
y
不包含字符串"ENST00000390399"
,它包含一个包含该字符串的列表:
for word in x:
for lst in y:
if word in lst:
print(lst)
答案 1 :(得分:1)
您可以使用列表推导来生成list
,其中找到的行如下所示:
y = [["ENST00000390399", "ENSG00000211752", "TRBV27"], ["x", "y", "z"]]
x = ["ENST00000390399"]
result = [lst for lst in y for word in lst if word in x]
输出:
[['ENST00000390399', 'ENSG00000211752', 'TRBV27']]
然后,如果您愿意,可以list
通过looping
在新行中打印每个result
。