Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python dictionary syntax
#1
can someone explain how the following dictionary definition is supposed to work?
Pycharm shows it as a syntaxial error, but the class I am taking shows it valid:

payload = {'email': 'password': 'badpass'}
Thank you
Reply
#2
(Apr-24-2023, 06:26 PM)nafshar Wrote: can someone explain how the following dictionary definition is supposed to work?
Pycharm shows it as a syntaxial error, but the class I am taking shows it valid:

payload = {'email': 'password': 'badpass'}
Thank you

It appears this is an error after all. It was just reported in the on-line class as well. Sorry about the confusion and thank you for looking at it.
Reply
#3
A dictionary work with key and values pair,so 3 item dos not work well.
>>> payload = {'email': 'some@thing', 'password': 'badpass'}
>>> payload = {'email': 'some@thing', 'password': 'badpass'}
>>> payload['email']
'some@thing'
>>> payload['password']
'badpass'
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  A Dictionary in a Dictionary Syntax PythonGainz 3 2,166 Apr-16-2020, 07:16 AM
Last Post: TomToad
  Convert List of Dictionary to dictionary of dictionary list in python kk230689 2 51,987 Apr-27-2019, 03:13 AM
Last Post: perfringo
  curious syntax with dictionary item inselbuch 3 2,770 Mar-09-2019, 04:21 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

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