规格: Python 3.3.2
我想做的是:
Create a simple name and employee number dictionary application. Have the user enter a list of names and employee numbers. Your interface should allow a sorted output (sorted by name) that displays employee names followed by their employee numbers.
我想出了什么:
# enter a list of names of employees
# enter a list of employee numbers
# zip them together
def hrcat():
name = input('Please enter names of employees: ')
number = input('Please enter employee numbers: ')
output = zip(name,number)
print(output)
问题:
当给定两个名称和数字列表时,它返回一个对象的内存地址;看起来像这样:
>>> hrcat()
Please enter names of employees: a,b,c
Please enter employee numbers: 1,2,3
<zip object at 0x7fea10ce4b90>
我想知道为什么它返回内存地址而不是该对象的实际内容?我在网上搜索,但无法找到解决这个问题的答案。感谢您的见解!