我有一个已经可以正常工作的函数,看起来像这样:
tolerance=5
def pmm_rag(data):
if ((data.SHIPMENT_MOT_x == 'AIR') & (data.latedeliverydate < data.m6plan)):
return 'R'
elif ((data.SHIPMENT_MOT_x == 'AIR') & (data.m6_event >= data.m6plan)):
return 'G'
elif ((data.SHIPMENT_MOT_x == 'AIR') & (data.m6_event >= data.m6plan)):
return 'A'
else:
return ''
我想在函数2中添加条件,但未填充结果:
def pmm_rag(data):
while data.m2 == '' is False:
if ((data.SHIPMENT_MOT_x == 'AIR') & (data.m6_event < data.m6plan)):
return 'R'
elif ((data.SHIPMENT_MOT_x == 'AIR') & (data.m6_event >= data.m6plan)):
return 'G'
elif ((data.SHIPMENT_MOT_x == 'AIR') & (data.m6_event >= data.m6plan)):
return 'A'
while data.m2 == '' is False:
if ((data.SHIPMENT_MOT_x == 'AIR') & (data.latedeliverydate < data.m6plan)):
return 'R'
elif ((data.SHIPMENT_MOT_x == 'AIR') & (data.latedeliverydate >= data.m6plan)):
return 'G'
elif ((data.SHIPMENT_MOT_x == 'AIR') & (data.latedeliverydate >= data.m6plan)):
return 'A'
else:
return ''
实际上,我想引入一会儿来循环一下有m2
和没有 public class Release
{
public int Id { get; set; }
public string Name { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public string OwnerId { get; set; }
public string OwnerName { get; set; }
public bool Finished { get; set; }
public bool InProgress { get; set; }
public bool Aborted { get; set; }
}
的行吗?
我该怎么办?
答案 0 :(得分:0)
您应该使用此条件。
if data.m2 != '':
如果要遍历data.m2的元素,则应使用“ for”语句:
for x in data.m2: