Python list object is not callable for a list of integers -
this question has answer here:
i error: 'list' object not callable... looked around in google , tried every given solution, it's still same. cannot code work. have list of integers, , need give every element different variables.
dmy = input('what date? please put in this: 2.11.2016') dmy.strip(".") dmy = [int(x) x in dmy.split('.')] list(dmy) print(dmy) dd = dmy(0) mm = dmy(1) yy = dmy(2)
the first part of code working. error while trying give list element variable dmy(0) not work. in books have way?
i use python 3.5.2
i see trying do. element in list obtained list[index]
format. while trying call list(index)
python interpreting function call , hence throwing error:
typeerror: 'list' object not callable
corrected code:
dmy = input('what date? please put in this: 2.11.2016') dmy.strip(".") dmy = [int(x) x in dmy.split('.')] list(dmy) print(dmy) dd = dmy[0] mm = dmy[1] yy = dmy[2]
Comments
Post a Comment