Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #109897

Re: passing dictionay as argument

From "Frank Millman" <frank@chagford.com>
Newsgroups comp.lang.python
Subject Re: passing dictionay as argument
Date 2016-06-13 13:39 +0200
Message-ID <mailman.35.1465818002.2288.python-list@python.org> (permalink)
References <0b6372ce-3f16-431b-9e72-42d5c935df14@googlegroups.com> <njm61q$tpm$1@ger.gmane.org>

Show all headers | View raw


"Arshpreet Singh"  wrote in message 
news:0b6372ce-3f16-431b-9e72-42d5c935df14@googlegroups.com...

> I have to pass dictionary as function argument for following code:

[...]

> result = authorize.Transaction.sale({
>     'amount': 40.00,
>
>     'credit_card': {
>         'card_number': '4111111111111111',
>         'expiration_date': '04/2014',
>         'card_code': '343',
>     }
>

[...]

> I want to define 'credit-card' dictionary as argument in the function as 
> follows but it returns syntax error:
>
> # define dictionary outside the function call:
> credit_card={
>         'card_number': '4111111111111111',
>         'expiration_date': '04/2014',
>         'card_code': '343',
>     }
>

[...]

> result = authorize.Transaction.sale({'amount': 40.00,credit_card})

Try this -

    result = authorize.Transaction.sale({'amount': 40.00, 
'credit_card':credit_card})

Frank Millman

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

passing dictionay as argument Arshpreet Singh <arsh840@gmail.com> - 2016-06-13 03:54 -0700
  Re: passing dictionay as argument David Navarro <davisein@gmail.com> - 2016-06-13 13:22 +0200
  Re: passing dictionay as argument marco.nawijn@colosso.nl - 2016-06-13 04:36 -0700
  Re: passing dictionay as argument "Frank Millman" <frank@chagford.com> - 2016-06-13 13:39 +0200

csiph-web