Tuple no attribute error - Python Forum
https://python-forum.io/thread-13250.html06.10.2018 · Then line will be a string which you can split. You could also access only the second element of the tuple - the string you want to split: 1. 2. for line in enumerate(yrs_file): (pdate,catg,amt,howp) = line [1].split (',') But in any case, I don't really see why you would need enumerate () in your code at all. Reply.
AttributeError: ‘tuple’ object has no attribute – Fix Code Error
fix.code-error.com › attributeerror-tuple-objectMar 14, 2021 · Solution. You return four variables s1,s2,s3,s4 and receive them using a single variable obj. This is what is called a tuple, obj is associated with 4 values, the values of s1,s2,s3,s4. So, use index as you use in a list to get the value you want, in order. obj =list_benefits () print obj [ 0] + " is a benefit of functions!"
python - AttributeError: 'tuple' object has no attribute ...
stackoverflow.com › questions › 17290114Jun 25, 2013 · Variables names are only locally meaningful. Once you hit. return s1,s2,s3,s4. at the end of the method, Python constructs a tuple with the values of s1, s2, s3 and s4 as its four members at index 0, 1, 2 and 3 - NOT a dictionary of variable names to values, NOT an object with variable names and their values, etc.