I recently had a question about data types.
Since then I have been trying to use NamedTuples (with more or less success).
My problem now:
- How to import lines from a file into new tuples,
- How to import values ββseparated by a space / tab (/ all) into a given part of a tuple?
Like:
Monday 8:00 10:00 ETR_28135 lh1n1522 Computer science 1
Tuesday 12:00 14:00 ETR_28134 lh1n1544 Geography EA 1
The first line should go into the tuple [0]. The first data: tuple [0] .day; second: tuple [0] .start; .. and so on.
And when a new line begins (two TAB (\ t), start a new tuple, for example, tuple [1]).
I use this to split data:
with open(Filename) as f:
for line in f:
rawData = line.strip().split('\t')
And the rest of the logic is still missing (filling in tuples).
( , , - , , . , , .. , . .)