Python Forum
python display with '\\' when prints with key-value in dictionary
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python display with '\\' when prints with key-value in dictionary
#5
This is again printing each keys and value through loop, not in a single go.

but the wonder is why dictionary is adding extra slash to that when it is printing whole dictionary. But when print that key alone it won't add that extra slash.

I know the meaning of escape sequence n all, am a Core C and C++ developer. but just a wonder to know that why python is adding to that and how to avoid printing extra slash.

and mean time I wanted to print dictionary at a single go, not in any loop.

if any one knows, how to print the whole dictionary at one go and without adding extra slash as well.

like for the same below program I want the below output format
#!/bin/python

dict = {
'name': ""
}

dict['name'] = "{}".format("\python")
print(dict)

output: {'name': '\python'}

but not as an -- {'name': '\\python'}.

if any one knows, how to avoid to print extra slash, plz do let me know. Thanks in advance.
Reply


Messages In This Thread
RE: python display with '\\' when prints with key-value in dictionary - by maiya - Apr-21-2020, 05:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to display <IPython.core.display.HTML object>? pythopen 3 45,996 May-06-2023, 08:14 AM
Last Post: pramod08728
  zfill prints extra et the end of a var tester_V 4 915 Mar-24-2023, 06:59 PM
Last Post: tester_V
  How can I display dictionary in a gui window in Python? C0D3R 2 1,746 Apr-07-2022, 07:33 PM
Last Post: C0D3R
  variable prints without being declared. ClockPillow 2 1,821 Jul-11-2021, 12:13 AM
Last Post: ClockPillow
  python prints none in function output chairmanme0wme0w 3 2,231 Jul-07-2021, 05:18 PM
Last Post: deanhystad
  Output prints Account.id at the end? LastStopDEVS 5 2,795 Dec-19-2020, 05:59 AM
Last Post: buran
Information Unable to display joystick's value from Python onto display box MelfoyGray 2 2,245 Nov-11-2020, 02:23 AM
Last Post: MelfoyGray
  Try/Exept prints only ones tester_V 11 3,907 Nov-03-2020, 02:38 AM
Last Post: tester_V
  loop only prints last character. mcmxl22 1 1,732 Feb-17-2020, 02:36 AM
Last Post: menator01
  How To Display this Python Code in Web browser? pradhan 1 3,340 Jul-14-2019, 06:59 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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