Python Forum
Need help improving function that reads file into list of tuples
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help improving function that reads file into list of tuples
#5
So, perhaps something like this?:

        if isinstance(damages, float) == True:
            damages = float(damages)
        else:
            damages = int('0')
But that still leaves my utah tuple with a final value of 0.
Reply


Messages In This Thread
RE: Need help improving function that reads file into list of tuples - by t4keheart - Nov-02-2020, 11:45 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Adding values with reduce() function from the list of tuples kinimod 10 2,814 Jan-24-2023, 08:22 AM
Last Post: perfringo
Question convert unlabeled list of tuples to json (string) masterAndreas 4 7,564 Apr-27-2021, 10:35 AM
Last Post: masterAndreas
  Count number of occurrences of list items in list of tuples t4keheart 1 2,421 Nov-03-2020, 05:37 AM
Last Post: deanhystad
  Improving my understanding of functions and methods menator01 2 2,203 Apr-24-2020, 06:26 AM
Last Post: menator01
  Dictionary and tuples list comprehensions help paul41 2 2,443 Nov-29-2019, 06:59 PM
Last Post: perfringo
  Writing list as a file, then reading that file as a list Zoastria_Balnala 3 2,675 Oct-17-2019, 07:54 PM
Last Post: Zoastria_Balnala
  I created a function that generate a list but the list is empty in a new .py file mrhopeedu 2 2,365 Oct-12-2019, 08:02 PM
Last Post: mrhopeedu
  Converting List into list of tuples ARV 4 4,851 Sep-28-2019, 04:58 AM
Last Post: perfringo
  Improving code to autorename if filename exists Den0st 5 3,043 Sep-23-2019, 07:53 AM
Last Post: wavic
  reading txt file putting in list function Expel 7 3,872 Jul-17-2019, 03:18 PM
Last Post: Expel

Forum Jump:

User Panel Messages

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