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

2nd Nov 2018, 2:54 PM
Uthpala
8 Réponses
+ 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)?
2nd Nov 2018, 3:13 PM
Kirk Schafer
Kirk Schafer - avatar
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.
2nd Nov 2018, 3:11 PM
strawdog
strawdog - avatar
0
@strawdog my file is in the directory where python application is running....
3rd Nov 2018, 9:35 AM
Uthpala
0
@Krik I have permission to files.....
3rd Nov 2018, 9:35 AM
Uthpala
0
please help me....I have got strucked here
3rd Nov 2018, 9:36 AM
Uthpala
0
Thanks guys got it....but how to display specific content of data from that file?
3rd Nov 2018, 1:15 PM
Uthpala
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.
3rd Nov 2018, 10:26 PM
Kirk Schafer
Kirk Schafer - avatar
0
@Kirk Got it.....tq so much....I will link a codeplay with code which I tried...
4th Nov 2018, 7:05 AM
Uthpala