![]() |
| Thread Tools | ![]() |
Display Modes |
|
|
#1 |
|
Status: Guest
Posts: n/a
|
Hi,
I have a file with data written in a "matrix" form. In other words, every row contains a fixed number of fields and I am interested in the value of each field of every row. I managed to read rows in the following way: f = open('filename.dat','r') for line in f: x = line f.close() However, I cannot find out how to split every line into fields? What should I do if I, let's say, need a value which is located in the third row in the second column (field). Thank you! |
|
|
|
#2 |
|
Status: Guest
Posts: n/a
|
I found line.split()! It works great! I think it is exactly what I
need. Or may be there are some more elegant solutions? |
|
|
|
#3 |
|
Status: Guest
Posts: n/a
|
On Oct 1, 5:07 am, Kristaps Kûlis <Kristaps.Ku...@gmail.com> wrote:
> On Oct 1, 2:58 am, Kurda Yon <kurda...@yahoo.com> wrote: > > > I found line.split()! It works great! I think it is exactly what I > > need. Or may be there are some more elegant solutions > > Why are you posting in comp.lang.php questions about language with is > not connected to PHP ? > > LOL Sorry, I did it by a mistake. It should be python... Thank you that you indicated that. |
|
|
|
#4 |
|
Status: Junior Member
Join Date: Aug 2009
Posts: 1
|
Bonjour,
si vous etes à la recherche de ressources relatifs à l'intelligence économique, à la veille ou au knowledge managment, vous trouverez votre bonheur sur le site du professeur luc quoniam, professeur en intelligence économique A bientot |
|
|
|
|
|
#5 |
|
Status: Senior Member
Join Date: Jul 2009
Posts: 141
|
if you wish to be understood , then you can speak english.
![]() |
|
|
|
|
|
#6 |
|
Status: Junior Member
Join Date: Mar 2010
Posts: 17
|
Tutorials are forever in these problems!!!))
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Re: FAQ 5.28 How can I read in an entire file all at once? | Peter J. Holzer | CGI | 0 | 10-27-2008 04:04 PM |
| AspectJ: solution to Java's repetitiveness? | jhc0033@gmail.com | JSP and Java | 93 | 08-21-2008 07:23 AM |
| Perl read file eat up my memory... | howa | CGI | 5 | 08-21-2008 07:11 AM |
| Re: Read data from Access MDB file? | Richard | PHP and MySQL | 0 | 08-20-2008 11:20 PM |
| Re: Read data from Access MDB file? | Richard | PHP and MySQL | 0 | 08-20-2008 11:20 PM |