python optional arguments
def myfunc(a,b, *args, **kwargs):
c = kwargs.get('c', None)
d = kwargs.get('d', None)
#etc
myfunc(a,b, c='nick', d='dog', ...)
python optional arguments
def myfunc(a,b, *args, **kwargs):
c = kwargs.get('c', None)
d = kwargs.get('d', None)
#etc
myfunc(a,b, c='nick', d='dog', ...)
how to make an argument optional in python
#set the variable = to None, and then write over none if there the argument
#is used.
async def joke(ctx, args=None):
if args == None:
await ctx.send('you :D')
else:
await ctx.send('%s is the true joke' % args)
optional argument python
def myfunc(a,b, *args, **kwargs):
c = kwargs.get('c', None)
d = kwargs.get('d', None)
#etc
myfunc(a,b, c='nick', d='dog', ...)
optional arguments python
def some_function (self, a, b, c, d = None, e = None, f = None, g = None, h = None):
#code
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us