Reputation: 15
I'm using this inside the function to get month and year input,
mon = ""
while mon not in 'januar februar mart april maj jun jul avgust septembar oktobar novembar decembar'.split:
mon = input('Mesec: ')
mon = mon.lower()
yr = ""
print('Molim vas izaberite godinu. (npr. 2014)')
while int(yr) not in range(2013,2050):
yr = input()
and it's giving me next:
Traceback (most recent call last):
File "C:\Python33\Scan-inprogress.py", line 255, in <module>
docMonthMoney(data)
File "C:\Python33\Scan-inprogress.py", line 151, in docMonthMoney
while mon not in 'januar februar mart april maj jun jul avgust septembar oktobar novembar decembar'.split:
TypeError: argument of type 'builtin_function_or_method' is not iterable
What's the problem?
Upvotes: 0
Views: 71
Reputation: 121974
You need to call split
:
while mon not in "...".split():
# ^ note parentheses
Otherwise, you are trying to iterate through (the builtin_function_or_method
) str.split
, rather than the list of strings calling it returns.
Upvotes: 3