Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 multiple values as parameters to POST command..
#18
(Feb-23-2018, 12:57 PM)buran Wrote:
>>> x = 'running'
>>> status = x == 'running' and 'OK' or 'Failed'
>>> status
'OK'
>>> x = 'stopped'
>>> status = x == 'running' and 'OK' or 'Failed'
>>> status
'Failed'
>>>
alternative

statuses = {'running': 'OK'}
for reservation in desc['Reservations']:
    for instance in reservation['Instances']:
        status = statuses.get(instance['State']['Name'], 'Failed')
Of course good old if/else would also do the job

Thank you so much buran ! the problem resolved :)
Quote

Top Page

Messages In This Thread
RE: multiple values as parameters to POST command.. - by onenessboy - Feb-25-2018, 09:57 AM

Possibly Related Threads...
Thread Author Replies Views Last Post
  How to pass multiple values from one sample to nc variable? Baloch 0 95 Jun-01-2020, 09:27 PM
Last Post: Baloch
  Inserting values from multiple lists sqlite azulu 1 257 May-24-2020, 08:40 AM
Last Post: ibreeden
  UnUnloading values from multiple widgets in a container UGuntupalli 3 249 Apr-20-2020, 08:53 PM
Last Post: UGuntupalli
  Taking Multiple Command Line Argument Input bwdu 6 267 Mar-29-2020, 05:52 PM
Last Post: buran
  Save all values to pandas of multiple classes jenniferruurs 0 260 Sep-13-2019, 12:10 PM
Last Post: jenniferruurs
  sort lists of lists with multiple criteria: similar values need to be treated equal stillsen 2 522 Mar-20-2019, 08:01 PM
Last Post: stillsen
  Try for multiple values bluethundr 1 574 Mar-07-2019, 09:04 PM
Last Post: bluethundr
  Help with passing command line input to HTTP POST json sf05wrx 2 489 Feb-25-2019, 11:19 PM
Last Post: sf05wrx
  Get multiple values from function and total it. nirlep 5 785 Feb-05-2019, 06:54 AM
Last Post: nirlep
  comparing multiple values Skaperen 5 7,139 Dec-06-2017, 03:25 AM
Last Post: wavic

Forum Jump:


Users browsing this thread: 1 Guest(s)