passing keyword args as a parameter

M

max(01)*

hi there!

this post is somewhat a generalization of one previous question.

i was wondering if it is possible to pass an argument list as a
parameter to a function. example:

def fun_con_pc(pc1 = "Ciao!", pc2 = 42):
print pc1
print pc2

fun_con_pc()
fun_con_pc(pc1 = "Addio...")

fun_con_pc(pc2 = 666, pc1 = "Addio...")

arg = 'pc2 = 666, pc1 = "Addio..."'
fun_con_pc(arg)

.....

if i execute, i get:

Ciao!
42
Addio...
42
Addio...
666
pc2 = 666, pc1 = "Addio..."
42

**but** i want to get:

Ciao!
42
Addio...
42
Addio...
666
Addio...
666

.....

see what i mean?

bye

macs
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top