Sep-27-2019, 09:04 AM
(This post was last modified: Sep-27-2019, 09:04 AM by jollydragon.)
offset can not be negative in File.seek()?
offset can not be negative in File.seek()?
|
||||
Sep-27-2019, 11:46 AM
What is
csv_file ?
With the right whence-flag, you can use negative numbers.
Look here: https://docs.python.org/3/library/io.htm...OBase.seek
In addition, I've used pathlib.Path, which is better to handle. You can still use the built-in function open() .The resulting file-object is the same as from Path.open(mode) .
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Sep-27-2019, 01:35 PM
(This post was last modified: Sep-27-2019, 01:35 PM by jollydragon.)
Sep-27-2019, 07:01 PM
The negative seek works if the file is opened in binary mode 'rb'.
Sep-28-2019, 12:05 AM
Sep-28-2019, 03:08 AM
(This post was last modified: Sep-28-2019, 03:08 AM by jollydragon.)
Found the explaination on internet, and thank you again.
| ||||
|
Users browsing this thread: 1 Guest(s)