[BlindMath] Python, question

Jonathan Fine jfine2358 at gmail.com
Tue Feb 23 13:04:36 UTC 2021


Hi Hedvig

I'm a long time Python programmer. I'm fortunate to have good sight. I
agree with Taksn, having a sample of the text file would help. I hope the
rest of this post is not off-topic.

If the format of the text file is simple, a solution using Python's builtin
commands might be easier.  For example, here's how to split a line into a
key-value pair

>>> line = '123 Hello world.'
>>> pair = line.split(' ', 1)
>>> key = int(pair[0])
>>> value = pair[1]

We can then use key-value to update a dictionary.

>>> dct = dict()
>>> dct[key] = value
>>> dct
{123: 'Hello world.'}

If this, or something similar, is good for you then the remaining problem
is to read the file and lines and to process them in a loop. And perhaps
some other details.

I'm grateful to Taksin for mentioning
https://www.freelists.org/list/program-l, which I'd not seen before. I hope
from this thread I'll learn something about programming by persons with a
visual disability.

best wishes

Jonathan


More information about the BlindMath mailing list