如何按行使用CSV文件的大小?是否可以使用Python
我正在阅读一个没有PANDAS库的CSV文件,我需要找出每一行的字节数。
file="Emptycsv.csv"
checkfilesize(file)
def checkfilesize(file):
file=b''join(file).split(b'\n')
count=len(file)
计数将打印行数。我需要找出文件大小,我知道os.path.getsize会..但是,在读取CSV文件行的读取该文件行/列或列时,如果达到109997897KB,我需要终止因此,请您帮助我查找数据字节
I am reading a csv file without pandas library,i need to find out the number of bytes of each row.So i can ad all the bytes and determine the file size and will do some restriction based on that.
file="Emptycsv.csv"
checkfilesize(file)
def checkfilesize(file):
file=b''join(file).split(b'\n')
count=len(file)
Count will print the number of rows.i need to find out the file size,i know os.path.getsize will do..But while reading that csv file row by rows/column or columns if it reached 109997897kb,i need to terminate.So request you to help me the find the bytes of data
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
按照此方面的某些内容应适用于每行/行的字节:
(+1用于新线)
输出:
Something along the lines of this should work for getting the bytes per row/line:
(The +1 is for the newline)
Output: