Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #89568
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!bloom-beacon.mit.edu!bloom-beacon.mit.edu!panix!gordon |
|---|---|
| From | John Gordon <gordon@panix.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: seek operation in python |
| Date | Wed, 29 Apr 2015 18:53:21 +0000 (UTC) |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Lines | 17 |
| Message-ID | <mhr9b1$h62$1@reader1.panix.com> (permalink) |
| References | <8b2bd328-08a6-4211-85c4-8d117d1aae1e@googlegroups.com> |
| NNTP-Posting-Host | panix1.panix.com |
| X-Trace | reader1.panix.com 1430333601 17602 166.84.1.1 (29 Apr 2015 18:53:21 GMT) |
| X-Complaints-To | abuse@panix.com |
| NNTP-Posting-Date | Wed, 29 Apr 2015 18:53:21 +0000 (UTC) |
| User-Agent | nn/6.7.3 |
| X-Received-Bytes | 1300 |
| X-Received-Body-CRC | 2308050293 |
| Xref | csiph.com comp.lang.python:89568 |
Show key headers only | View raw
In <8b2bd328-08a6-4211-85c4-8d117d1aae1e@googlegroups.com> siva sankari R <buddingrose11@gmail.com> writes:
> file=open("input","r")
> line=file.seek(7)
> print line
> The above code is supposed to print a line but it prints "none".
> I don't know where the mistake is. Help.!
The seek() function doesn't return any data; it just relocates the file
pointer. You still have to do a read operation to get data from the
new location.
--
John Gordon Imagine what it must be like for a real medical doctor to
gordon@panix.com watch 'House', or a real serial killer to watch 'Dexter'.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
seek operation in python siva sankari R <buddingrose11@gmail.com> - 2015-04-29 11:08 -0700
Re: seek operation in python Joel Goldstick <joel.goldstick@gmail.com> - 2015-04-29 14:17 -0400
Re: seek operation in python siva sankari R <buddingrose11@gmail.com> - 2015-04-29 11:26 -0700
Re: seek operation in python Billy Earney <billy.earney@gmail.com> - 2015-04-29 13:42 -0500
Re: seek operation in python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-04-29 21:53 +0100
Re: seek operation in python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-04-30 10:19 +1000
Re: seek operation in python MRAB <python@mrabarnett.plus.com> - 2015-04-29 19:50 +0100
Re: seek operation in python John Gordon <gordon@panix.com> - 2015-04-29 18:53 +0000
Re: seek operation in python Chris Angelico <rosuav@gmail.com> - 2015-04-30 10:33 +1000
Re: seek operation in python Cecil Westerhof <Cecil@decebal.nl> - 2015-04-30 08:27 +0200
Re: seek operation in python Chris Angelico <rosuav@gmail.com> - 2015-04-30 17:33 +1000
Re: seek operation in python Cecil Westerhof <Cecil@decebal.nl> - 2015-04-30 10:06 +0200
Re: seek operation in python Dave Angel <davea@davea.name> - 2015-04-30 04:31 -0400
Re: seek operation in python Cecil Westerhof <Cecil@decebal.nl> - 2015-04-30 11:06 +0200
Re: seek operation in python Chris Angelico <rosuav@gmail.com> - 2015-04-30 19:39 +1000
Re: seek operation in python Larry Hudson <orgnut@yahoo.com> - 2015-04-30 12:38 -0700
Re: seek operation in python Cecil Westerhof <Cecil@decebal.nl> - 2015-04-30 22:50 +0200
Re: seek operation in python Larry Hudson <orgnut@yahoo.com> - 2015-04-30 19:42 -0700
Re: seek operation in python Cecil Westerhof <Cecil@decebal.nl> - 2015-04-30 14:31 +0200
csiph-web