CODE Code related to printing index values (dankFF) (1 Viewer)

FusionFall.org

Website Owner
Staff member
Website Owner
Member
saving indexes and data to txt file (except lengthy data) (default-sorted):

cab_data = {}; to_write = ""
for index in tabledata.objects.keys(): cab_data[index] = tabledata.objects[index].contents
for index in cab_data.keys(): cab_data[index] = "" if len(str(cab_data[index])) > 30 else cab_data[index]
for index in cab_data.keys(): to_write += f"{index} | {cab_data[index]}\n"
open("cab_data.txt",'w').write('\n'.join(sorted(to_write.splitlines())))

saving indexes and data to txt file (except lengthy data):

cab_data = {}; to_write = ""
for index in tabledata.objects.keys(): cab_data[index] = tabledata.objects[index].contents
for index in cab_data.keys(): cab_data[index] = "" if len(str(cab_data[index])) > 30 else cab_data[index]
for index in cab_data.keys(): to_write += f"{index} | {cab_data[index]}\n"
open("cab_data.txt",'w').write(to_write)

printing indexes:

for _ in tabledata.objects.keys(): print(_)

saving indexes and data to txt file:


cab_data = ""
for index in tabledata.objects.keys(): cab_data += f'{index}\n{tabledata.objects[index].contents}\n'
open("cab_data.txt",'w').write(cab_data)
 

Attachments

  • indexcode.txt
    1.1 KB · Views: 37
Top