I need help with importing a file and converting each line into a list.
An example of the file would look like:
p wfgh 1111 11111 111111
287 48 0
65626 -1818 0
4654 21512 02020 0
The first line beginning with p is a header and the rest are clauses. Each clause line must begin with a series of at least two integers and finish with a zero
thanks in advance
The following line will create a list where each item is a list. The inner list is one line thats split up into "words".
I put the code snippet you posted into a input.txt file in c:\temp and ran this line. Is the output similar to what you want?
If you want all of the values in a flat list, the code would look as follows:
If you just want the lines in a list then you can stop at readlines().