Reading a file in python issues -


i trying read csv file in python using following code:

with open(self.filename, 'r') openfile:             datareading = openfile.read()         openfile.close()         splitdata = datareading.split("\n")         print splitdat 

a don't understand why not getting output.

self.filename meant represent file location on computer, , attempting open , split there new lines. can please assist me problem?

you storing read line in datareading , doing read_data.split()

you might intending this:

def convert(self):         datareading = []         open(self.filename, 'r') openfile:             datareading = openfile.readlines()         data in datareading:             print data 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -