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)