Very new to python here. How do you split a very long dictionary value over two lines while still having it appear as one line when it is output with print()? See code below.
glossary = {'dictionary' : 'A mutable associative array (or dictionary) of key and value pairs. Can contain mixed types (keys and values). Keys must be a hashable type'}
I’ve tried using triple quotes (i.e. """) with no success since I don’t think the value is technically a string.
>Solution :
you can use \ (backslash) to continue code onto the next line
e.g.
print("hello \
how are you")
would return
hello how are you
edit: you should be able to use """ as (from my understanding) it just converts it to a normal string but adds the line breaks. this wouldnt give the result you wanted but it should work
edit: just tested the above:
list = ['hi', '''thing1
thing2''']
print(list)
ouput:
['hi', 'thing1\nthing2']
that \n means newline so i would use the backslash as i mentioned above if you want the correct output