码迷,mamicode.com
首页 > 编程语言 > 详细

python读取并切分

时间:2015-04-02 09:08:44      阅读:195      评论:0      收藏:0      [点我收藏+]

标签:python

#!/usr/bin/env python
import numpy as np
fl = open(‘te.csv‘)
try:
  text = fl.readline( )
finally:
  print text
  #fl.close( )
#print text
#data = np.loadtxt("\usr\data\tianchi_mobile_recommend_train_user.csv", dtype=‘int‘)
#print data

data = np.loadtxt(fl,dtype = str)

#X = data[:, 1:]  # select columns 1 through end

#y = data[:, 0]   # select column 0, the stock price
for key in data:
# print data[key]
  print key.split(‘,‘)
#  print key
fl.close()

python读取并切分

标签:python

原文地址:http://blog.csdn.net/ozuoqi/article/details/44820529

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!