forked from hungnguyengoc/rps_citi_mljun2018
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfilereadingdemo.py
34 lines (21 loc) · 960 Bytes
/
filereadingdemo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 11 14:23:04 2018
@author: Balasubramaniam
"""
import os
path="C:/Program Files (x86)/Microsoft Visual Studio/Shared/Anaconda3_64/Lib/site-packages/sklearn/datasets/data"
if(os.path.exists(path)):
print("directory exists")
for(dirpath,dirnames,filenames) in os.walk(path):
for file in filenames:
(fileName,extension)=os.path.splitext(file)
if((extension==".csv") and (fileName=="iris")):
#print(fileName)
#read file content
contents=open(path+"/"+file,"r")
rows=[]
for line in contents:
rows.append(line)
for row in rows[1:]:
print(row)