import tensorflow as tf
import tensorflow.contrib.eager as tfe
import glob
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
tf.enable_eager_execution()
def csvread(filelist):
list1 = (tf.data.TextLineDataset(filelist)
.map(lambda text: tf.string_split([text],delimiter=",").values)) # 使用逗号分隔符
iterator = tfe.Iterator(list1)
for i in iterator:
print(i)
if __name__ == '__main__':
filelist = [i for i in glob.glob("data/*.csv")]
csvread(filelist=filelist)
#!/usr/bin/python
# -*- coding: UTF-8 -*-
__author__ = "HeliantHuS"
__version__ = "1.0"
"""
@ Author: HeliantHuS
@ Codes are far away from bugs with the animal protecting
@ Time: 2019/6/12
@ FileName: read_csvfiletest.py
"""
import tensorflow as tf
import tensorflow.contrib.eager as tfe
import glob
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
tf.enable_eager_execution()
def csvread(filelist):
list1 = (tf.data.TextLineDataset(filelist)
.map(lambda text: tf.string_split([text],delimiter=",").values)) # 使用逗号分隔符
print(type(list1))
iterator = tfe.Iterator(list1)
for i in iterator:
print(i)
if __name__ == '__main__':
filelist = [i for i in glob.glob("data/*.csv")]
csvread(filelist=filelist)