| View previous topic :: View next topic |
| Author |
Message |
kadamat
Joined: 01 Jun 2006 Posts: 88
|
| If i have an integer, and say for example that integer is 500, how do i tell python to read line 500 from a file? |
| |
|
|
|
|
PaulKolin
Joined: 25 May 2006 Posts: 108
|
| kadamat: read the first 500 lines, thowing away the first 499 |
| |
|
|
kadamat
Joined: 01 Jun 2006 Posts: 88
|
| Using a loop? |
| |
|
|
PaulKolin
Joined: 25 May 2006 Posts: 108
|
| kadamat, yes or if your file is not to big, you can also use f.readlines()[499] to get 500th line |
| |
|
|
|
|