Dmitry_Dronov

kwargs

Apr 21st, 2016
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. # Вывод на печать значение ключа и значение функции
  2. def printab(a,b,**kwargs):
  3.     print("positional argument a:", a)
  4.     print("positional argument b:", b)
  5.     print("additional arguments:")
  6.     for key in kwargs:
  7.         print(key, kwargs[key])
  8.  
  9. printab(10, 20, c=30, d=40, jimmi=123)
  10. # positional argument a: 10
  11. # positional argument b: 20
  12. # additional arguments:
  13. # jimmi 123
  14. # c 30
  15. # d 40
Add Comment
Please, Sign In to add comment