• Register

Recent questions tagged python-3

0 votes
1 answer 16 views
I can simply import a build-in python module, or the modules, what I install by pip command, using the import keyword in python terminal. but suppose I have my own user-defined module, that I have stored somewhere in my computer, and I want to import it using import keyword in the python terminal. then what shall I do?
asked Nov 16 chandan01 120 points
0 votes
1 answer 19 views
Problem: How Can I check if two lists are equal in python?
asked Nov 11 deep 220 points
1 vote
1 answer 13 views
TypeError during django project Got this message on the error page: TypeError at /music/1/ detail() got an unexpected keyword argument 'pk' Request Method: GET Request URL: http://127.0.0.1:8000/listing/1/ Exception Type: TypeError detail() got an unexpected keyword argument 'pk' This ... , # /music/<album_id>/favorite url(r'^(?P<album_id>[0-9]+)/favorite/$', views.favorite, name = 'favorite'), ]
asked Nov 9 kevin muturi 220 points
1 vote
1 answer 21 views
I tried to use is_authenticated() in a view, but got the error `TypeError: 'bool' object is not callable. How do I fix it? This is my code def func_name(): if current_user.is_authenticated() \ and not current_user.confirmed \ and request.endpoint[:5] != ' ... ('auth.unconfirmed')) In some cases a class might implement __call__ function which you can call an object too, then it will be callable.
asked Nov 8 kevin muturi 220 points
0 votes
1 answer 13 views
Please explain with some examples?
asked Nov 5 jagruthi 680 points
0 votes
1 answer 10 views
it will be of great help ,if you define what is __repr__ in python...
asked Nov 3 user1 160 points
0 votes
1 answer 42 views
Problem Hello Kodlogs, My code is giving me nameerror: name 'unicode' is not defined. Here is the code # utf-8 ? we need unicode if isinstance(unicode_or_str, unicode): text = unicode_or_str decoded = False else: text = unicode_or_str.decode(encoding) ... if isinstance(unicode_or_str, unicode): NameError: global name 'unicode' is not defined It started happening on Python 3. Please help
asked Nov 3 hashq 1.1k points
0 votes
1 answer 18 views
Problem Hello Kodlogs, What is meant by EOFError in Python?
asked Oct 31 hashq 1.1k points
0 votes
1 answer 10 views
Problem Hello Kodlogs, I want to create a stopwatch program in Python? A code will explanation will be appreciated. Thanks
asked Oct 30 hashq 1.1k points
0 votes
1 answer 10 views
Problem Hello Kodlogs, I need to know what what are Python tokens. Any help will be appreciated. Thanks
asked Oct 30 hashq 1.1k points
0 votes
1 answer 17 views
0 votes
1 answer 22 views
0 votes
1 answer 21 views
I need someone to tell me what Destructors is
asked Oct 30 john 580 points
0 votes
1 answer 63 views
When trying to find the index of v but it gave me: 'numpy.ndarray' object has no attribute 'index' none of them have answered my question v = np.random.randn(10) print(v) maximum = np.max(v) minimum = np.min(v) print(maximum, minimum) v.index(maximum, minimum)
asked Oct 30 psandprop 2.4k points
0 votes
0 answers 7 views
I saw this code to find difference between diagonal sums of a square matrix. #!/bin/python3 import math import os import random import re import sys def diagonalDifference(arr): d1=0 d2=0 a=n-1 print(arr[1][1]) for i in range(0,n): d1+=arr[i][i] ... ['OUTPUT_PATH'], 'w') with fptr = sys.stdout, the output shows no difference. What then is the difference between functions of these two statements?
asked Oct 29 psandprop 2.4k points
0 votes
1 answer 15 views
What is the difference between Use of nonlocal and use of global keyword in Python?
asked Oct 29 john 580 points
0 votes
1 answer 29 views
0 votes
1 answer 27 views
Say we've used pandas dataframe[column].value_counts() that outputs: apple 5 sausage 2 banana 2 cheese 1 How does one extract the values within the order same as shown higher than from min to max ?
asked Oct 29 psandprop 2.4k points
0 votes
1 answer 18 views
What is the output of the following Python code fragment? Justify your answer. def extendList(val, list=[]): list.append(val) return list list1 = extendList(10) list2 = extendList(123,[]) list3 = extendList('a') print "list1 = %s" % list1 print "list2 = %s" % list2 print "list3 = %s" % list3
asked Oct 29 anonymous
0 votes
1 answer 17 views