Splat Operator in Python (*, **) - Unpack Iterables

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
many times in python you have a function something like this and the arguments for this function are stored in a list or in a dictionary now it can be quite annoying to have to call the function using the individual elements doing something like this so instead there is the syntax in python known as the splat operator or the unpack operator i'll show you that i can call the function func with star arcs now what this will do is actually unpack all of the items in my list into individual arguments and pass them to the function watch this when i run the code everything works fine now in the same way that you can do this on a list or on a string any iterable object if you have a dictionary so key value pairs you can simply make this two stars now i have to change the variable name here and this will pass keyword arguments so it will pass a equals one b equals three c equals four and d equals two hopefully you found this helpful if you did follow for more
Info
Channel: Tech With Tim
Views: 6,339
Rating: 4.9688716 out of 5
Keywords: tech with tim, splat, unpack, unpack python, python, python3, python programming, shorts, tech with tim shorts, unpack operator python, * python, ** python, python *, python **, unpack python tutorial, unpack iterables, *args and **kwargs, *args, *kwargs, python unpack, python splat, unpack operator, unpack list python, python unpacking
Id: 6igd8-2woeE
Channel Id: undefined
Length: 0min 49sec (49 seconds)
Published: Wed Oct 06 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.