Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tuple no attribute error
#1
Linux Mint 18.2 Python 3.5. Am old time BASIC person.
Help. Have no understanding how to deal with this.
An example please.


 #!/usr/bin/python3
 #
 with open( 'expenses-18', 'r') as yrs_file:
     for line in enumerate(yrs_file):
         (pdate,catg,amt,howp) = line.split(',')
         pdate = str(pdate)
         length = len(pdate)
         catg = int(catg)
         amt = float(amt)
         howp = int(howp)
# Will do stuff here. 
         print pdate, catg, amt, howp

Traceback (most recent call last):
  File "try-me.py", line 5, in <module>
    (pdate,catg,amt,howp) = line.split(',')
AttributeError: 'tuple' object has no attribute 'split'
Reply


Messages In This Thread
Tuple no attribute error - by oldcity - Oct-06-2018, 02:51 PM
RE: Tuple no attribute error - by ichabod801 - Oct-06-2018, 03:00 PM
RE: Tuple no attribute error - by j.crater - Oct-06-2018, 03:11 PM
RE: Tuple no attribute error - by snippsat - Oct-06-2018, 05:37 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Error: audioio has no attribute 'AudioOut' netwrok 3 661 Oct-22-2023, 05:53 PM
Last Post: netwrok
  cx_oracle Error - AttributeError: 'function' object has no attribute 'cursor' birajdarmm 1 2,402 Apr-15-2023, 05:17 PM
Last Post: deanhystad
  Getting 'NoneType' object has no attribute 'find' error when WebScraping with BS Franky77 2 5,286 Aug-17-2021, 05:24 PM
Last Post: Franky77
  Attribute Error received not understood (Please Help) crocolicious 5 2,703 Jun-19-2021, 08:45 PM
Last Post: crocolicious
  AttributeError: 'tuple' object has no attribute 'format' Anldra12 7 17,319 Apr-13-2021, 07:45 AM
Last Post: Anldra12
  error in scapy attribute 'haslayer' evilcode1 5 6,560 Mar-02-2021, 11:19 AM
Last Post: evilcode1
  code with no tuple gets : IndexError: tuple index out of range Aggam 4 2,847 Nov-04-2020, 11:26 AM
Last Post: Aggam
  attribute error instead of correct output MaartenRo 2 2,206 Aug-28-2020, 10:22 AM
Last Post: Larz60+
  attribute error stumped on how to fix it. hank4eva 7 4,790 Aug-11-2020, 04:47 AM
Last Post: hank4eva
  Python Error- TypeError: ('Params must be in a list, tuple, or Row', 'HY000') DarkCoder2020 3 5,608 Jul-29-2020, 12:02 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020