Python Forum
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
About the output format.
#1
I'm a newer to python, just have some simple format questions. Here is my code of creating a new function.

[python] >>> def make_complex(x,y):
... return{'y':y,'x':x}
>>> make_complex(4,2)
{'y': 2, 'x': 4}
[python]

and the second version is like this:

[python] >>> def make_complex(x,y):
... return{'x':x,'y':y,}
>>> make_complex(4,2)
{'y': 2, 'x': 4}
[python]

I found out that for the return part, I won't get the real order of what I define in the function. It turns out 'y' always be the first one to show up. Could anyone clear my confusion? Thanks.
Reply


Messages In This Thread
About the output format. - by shang2019 - Jan-10-2019, 05:35 AM
RE: About the output format. - by woooee - Jan-10-2019, 06:03 AM
RE: About the output format. - by buran - Jan-10-2019, 07:23 AM
RE: About the output format. - by shang2019 - Jan-10-2019, 06:01 PM
RE: About the output format. - by buran - Jan-10-2019, 07:38 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  format the output from a nested dictionary. nostradamus64 9 4,640 May-03-2021, 04:45 PM
Last Post: nostradamus64
  JupyterLab Dictionary Content Output Format Ourkid123uk 0 1,331 Sep-04-2020, 02:18 PM
Last Post: Ourkid123uk
  Format SQL Query Output phillyfa 2 4,090 Apr-22-2020, 07:45 AM
Last Post: buran
  Save output into a Excel Sheet with Format Table skaailet 1 2,523 Apr-17-2020, 11:56 PM
Last Post: thirteendec
  Display output in readable format and save hnkrish 1 2,663 Jul-19-2019, 09:29 AM
Last Post: Larz60+
  python script to get wildcard mask output in the following format techrichit 0 3,842 Aug-10-2018, 11:01 PM
Last Post: techrichit

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020