如何打印与键分开的乘法值



应该是employers library

如何输出如下:名字→Bugryanyi邮报》→会计Expereance→7等

all_staff = {"Name": ["Bagryanyi", "Antonovych", "Kostenko"], "Post": ["accountant", "developer", "roller"], "Experience": [7, 1, 3], "Portfolio": ["Documents", "Python", "joint"], "Efficiency": [97, 45, 83], "Stak": ["account", "Pyt", "blunt"], "Salary": [7000, 2000, 3500]}

如果您不想全部写出来,您可以使用for循环来完成:

all_staff = {"Name": ["Bagryanyi", "Antonovych", "Kostenko"], "Post": ["accountant", "developer", "roller"], "Experience": [7, 1, 3], "Portfolio": ["Documents", "Python", "joint"], "Efficiency": [97, 45, 83], "Stak": ["account", "Pyt", "blunt"], "Salary": [7000, 2000, 3500]}
s = ""
for key in all_staff:
s += str(key) + " -> " + str(all_staff[key][0])  + " "

print(s)

或者如果你想在一行中完成,你可以这样做:

all_staff = {"Name": ["Bagryanyi", "Antonovych", "Kostenko"], "Post": ["accountant", "developer", "roller"], "Experience": [7, 1, 3], "Portfolio": ["Documents", "Python", "joint"], "Efficiency": [97, 45, 83], "Stak": ["account", "Pyt", "blunt"], "Salary": [7000, 2000, 3500]}
s = " ".join([str(key) + " -> " + str(all_staff[key][0]) for key in all_staff])
print(s)

相关内容

  • 没有找到相关文章

最新更新