Using input as an argument in Python

230
February 05, 2018, at 08:55 AM

I'm trying to use an input as an argument. dsd is supposed to be the argument of permutations(e.g 2). keywords.txt is a text file with 4 words each separated by \n. But whenever i run this, there's this error:

for b in perm(k2, dsd):TypeError: Expected int as r**

from itertools import permutations
perm = permutations
k = open('keywords.txt', 'r')
k1 = k.readlines()
dsd = input("")

if dsd == 'exact':
    dsd == len(k1)
    print(len(k1))
k2 = [d.strip('\n') for d in k1]
for b in perm(k2, dsd):
    print(''.join(b))
Rent Charter Buses Company
READ ALSO
Different Celery instance objects using same broker - Is that a good practice?

Different Celery instance objects using same broker - Is that a good practice?

I was wondering, is it a good practice, to have different Celery instance objects using same broker?

234
Passing flags to Django call_command

Passing flags to Django call_command

How do you pass a flag to Django's call_command()?

230
Passing a variable from one function to a for loop in another

Passing a variable from one function to a for loop in another

Hey guys I have a question regarding passing a variableI'm basically interested in counting all the vowels in a certain string

231