File tree 1 file changed +33
-0
lines changed
1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Call normal of date function passing three parameters - year, month, day
2
+ from datetime import date
3
+ d = (2013 , 3 , 15 )
4
+ print (date (d [0 ], d [1 ], d [2 ]))
5
+
6
+ #Function date using packing to pass - year, month, day
7
+ from datetime import date
8
+ d = (2013 , 3 , 15 )
9
+ print (date (* d ))
10
+
11
+ #Other example using a dictionary data.
12
+ def new_user (active = False , admin = False , root = False ):
13
+ print (active )
14
+ print (admin )
15
+ print (root )
16
+
17
+ config = {"active" : False ,
18
+ "admin" : True ,
19
+ "root" : False }
20
+
21
+ new_user (config .get ('active' ), config .get ('admin' ), config .get ('root' ))
22
+
23
+ print ('Function using packing args' )
24
+ def new_user (active = False , admin = False , root = False ):
25
+ print (active )
26
+ print (admin )
27
+ print (root )
28
+
29
+ config = {"active" : False ,
30
+ "admin" : True ,
31
+ "root" : True }
32
+
33
+ new_user (** config )
You can’t perform that action at this time.
0 commit comments