0
Extraction of data from raw text
I'm getting error as no such directory when I'm trying to extract data from a test.txt file using file=open("test.txt") statement....please help me
8 Respuestas
+ 2
What's the current directory according to the running Python script?
Is the text file there?
Does Windows Explorer / file browser for your OS accept the path if you paste it, i.e., the path is navigable?
Note, try escaping backslashes: "C:\\path\\to\\test.txt"
[less likely cause, I'd expect a different error] Do you have permission to the file (and the path)?
0
Well, Python interpreter has never been cought lying. Looks like it really could not find a file you are trying to open. Where is your file located? If you do not provide additional path, then, according to your code, file test.txt must reside in the very directory you are running script from.
0
@strawdog
my file is in the directory where python application is running....
0
@Krik
I have permission to files.....
0
please help me....I have got strucked here
0
Thanks guys got it....but how to display specific content of data from that file?
0
Uthpala You might get more eyes on this if you...
~ Start a new question so viewers see the new topic
~ Link a CodePlayground code including:
* A data sample (probably a few lines at most, in a """block comment""")
* Any code you've tried to get at the data
* What you want to do with the sample (get it into variables, some new kind of output--what's line 1 look like when processed?--etc)
Without these you may get more generic suggestions that don't effectively use your time.
0
@Kirk
Got it.....tq so much....I will link a codeplay with code which I tried...