class IndexDetail(APIView):
def get(self, request, *args, **kwargs):
month = request.GET.get('month', None)
current_month = datetime.datetime.now().month
target_month = month if month is not None else current_month
print(target_month,type(target_month))
I am getting this error :
Internal Server Error: /api/user/index/
.......
.......
File "C:\Users\77922\PycharmProjects\Axepanda\user\views.py", line 34, in get
print(target_month,type(target_month))
TypeError: 'str' object is not callable
Hey guys,the error occurred when I wrote this " type(target_month)
" Thanks for helping me with this.
You assigned type
to a string. Don't assign a variable to a built-in variable name. If you print(type)
and it outputs a string, you'll know for sure.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.