Apr-21-2020, 05:30 PM
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.
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.