【发布时间】:2014-04-14 18:38:18
【问题描述】:
我有一个包含人员信息的文件,包括出生日期,并且希望能够调用 dd/mm/yyyy 格式的月份来查找出生月份的人员姓名。到目前为止,我有这个:
def DOBSearch():
DOBsrch = int(input("Please enter the birth month: "))
for row in BkRdr:
DOB = row[6]
day,month,year = DOB.split("/")
if DOB == month:
surname = row[0]
firstname = row[1]
print(firstname, " ",surname)
addrsBk.close
但它会返回
Please enter the birth month: 02
#(nothing is printed)
【问题讨论】:
-
if DOBsrch == month:???? -
这是正确的谢谢你
标签: python csv python-3.x opencsv