Python Forum
Writing many variables to a file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Writing many variables to a file
#4
(Dec-28-2016, 10:09 PM)birdieman Wrote: Everything works fine -- no problems.  My questions:

1. If I have say 100 variables, do I follow the same logic/pattern?

2.  Is there a better/faster/simpler way to write many variables?

thanks

If you have 100 variables the problem is keeping track of the 100 variables throughout the code, not just at the place where you print them...

What I would so is see if I can find logical groupings of these variables and make object classes from them. Then I can define/code the __str__(self) method in these classes and I just have to give the class instance in a print call and it would output the string with all its components... And these classes will likely have other profitable uses.
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply


Messages In This Thread
Writing many variables to a file - by birdieman - Dec-28-2016, 10:09 PM
RE: Writing many variables to a file - by j.crater - Dec-28-2016, 11:25 PM
RE: Writing many variables to a file - by wavic - Dec-28-2016, 11:46 PM
RE: Writing many variables to a file - by Ofnuts - Dec-30-2016, 12:23 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  File path by adding various variables Mishal0488 2 1,263 Apr-28-2023, 07:17 PM
Last Post: deanhystad
  Writing string to file results in one character per line RB76SFJPsJJDu3bMnwYM 4 1,604 Sep-27-2022, 01:38 PM
Last Post: buran
  Writing to json file ebolisa 1 1,112 Jul-17-2022, 04:51 PM
Last Post: deanhystad
  Writing to External File DaveG 9 2,803 Mar-30-2022, 06:25 AM
Last Post: bowlofred
  Storing variables into one file for use in multiple Jupyter notebooks devansing 1 1,904 Feb-05-2022, 10:04 AM
Last Post: ibreeden
  Writing to file ends incorrectly project_science 4 2,924 Jan-06-2021, 06:39 PM
Last Post: bowlofred
  Writing unit test results into a text file ateestructural 3 5,010 Nov-15-2020, 05:41 PM
Last Post: ateestructural
  Writing to file in a specific folder evapa8f 5 3,665 Nov-13-2020, 10:10 PM
Last Post: deanhystad
  Failure in writing binary text to file Gigux 7 4,050 Jul-04-2020, 08:41 AM
Last Post: Gigux
  writing data to a csv-file apollo 1 2,502 Jul-03-2020, 02:28 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

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