What\'s New in Python 3.9

(kamelia khammar) #1

version. Now Python three point nine supports a new
operator to take that action. So I'm going to comment
about those two lines and I'm going to write. Besides
that, merged equals two and then I'm going to write here
dict one and then use the pipeline sign and then write the
two. So that will do the same action like we did here. And
then I'm going to go down and try to print the merge out
and then you can see that those dictionaries are merged.
Now, if you want to update your dictionary with another
dictionary, so let's delete everything from here and I'm
going to use the update method of dictionaries. So we
are going to update dictionary one with dictionary, too.
So it will be dict one, that update, and then I will pass in
the tool. And then once I go ahead and print the dict
one, you will see that this dictionary one is updated with
all the keys and values of Dictionary two. Now Python
three point nine replaces this with the following
operator. So it will be dict one and then you will use
pipeline and then the equals sign and right here the
dictionary that you want to update with. So it will be dict
one pipeline and then equals sign to the two. And now I'm
going to print dict one again and then you can see that
the result is quite same. So this is also something new
with Python three point nine that you can definitely
use.Great. So if we talk about strings, Python three point
nine has it all new methods that you can apply for your
strings. Now, in the following example, I am having a list
of items, but you can see

Free download pdf