FastGFile
Defined in tensorflow/python/platform/gfile.py.
File I/O wrappers without thread locking.
modeReturns the mode in which the file was opened.
nameReturns the file name.
__init____init__(
name,
mode='r'
)
Initialize self. See help(type(self)) for accurate signature.
__enter____enter__()
Make usable with "with" statement.
__exit____exit__(
unused_type,
unused_value,
unused_traceback
)
Make usable with "with" statement.
__iter____iter__()
__next____next__()
closeclose()
Closes FileIO. Should be called for the WritableFile to be flushed.
flushflush()
Flushes the Writable file.
This only ensures that the data has made its way out of the process without any guarantees on whether it's written to disk. This means that the data would survive an application crash but not necessarily an OS crash.
nextnext()
readread(n=-1)
Returns the contents of a file as a string.
Starts reading from current position in file.
n: Read 'n' bytes if n != -1. If n = -1, reads to end of file.'n' bytes of the file (or whole file) in bytes mode or 'n' bytes of the string if in string (regular) mode.
readlinereadline()
Reads the next line from the file. Leaves the '\n' at the end.
readlinesreadlines()
Returns all lines from the file in a list.
seekseek(
offset=None,
whence=0,
position=None
)
Seeks to the offset in the file. (deprecated arguments)
SOME ARGUMENTS ARE DEPRECATED. They will be removed in a future version. Instructions for updating: position is deprecated in favor of the offset argument.
offset: The byte count relative to the whence argument.whence: Valid values for whence are:0: start of the file (default)1: relative to the current position of the file2: relative to the end of file. offset is usually negative.sizesize()
Returns the size of the file.
telltell()
Returns the current position in the file.
writewrite(file_content)
Writes file_content to the file. Appends to the end of the file.
© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/gfile/FastGFile