<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-2">
<META content="MSHTML 6.00.2800.1226" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hello ...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV><FONT face=Arial size=2>
<DIV><BR>About my yesterday question:</DIV>
<DIV><BR>I just noticed two "interesting" issues (probably releated only to my
configuration):</DIV>
<DIV> </DIV>
<DIV>1.) First I found out, after trying few times, closing Python, and
opening it again, that sometimes it open file (for reading/writting), and
sometimes just don't, arbitrary, meaning that its not like I couldn't open the
file always I try, therefore the most logical conclusion would be - I
miss-spelled the code, but no: I 100 % tryed with identical input, I
double, triple-checked the "code" ... </DIV>
<DIV>I use the method below, from Alan's tutorial (don't know, probably the
only one method for read/write files) ... </DIV>
<DIV>I also checked files (on Alan's suggestion), if the are accidentally set as
"read-only", I even unchecked "archive" (but that wouldn't explain why I could
open them yesteday) ... with no benefit - as I said sometimes just can, and
sometimes just can't (I second case I get "no such file or directory:
'somename.txt'" error message) !!</DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV> </DIV>
<DIV><FONT size=2>>>> inp =
open("lll.txt","r")
# made both files just before opening Python ...<BR>>>> outp =
open("ggg","w")<BR>... for line in
inp.readlines(): # for intendation here, I am not sure if its
right, cause I couldn't check it
...<BR>...
outp.write(line)
# before sending this mail, because of all mentioned above
...<BR>>>> inp.close()<BR>>>> outp.close()</DIV></FONT>
<DIV> </DIV>
<DIV> </DIV>
<DIV>So, I was surely surprised yesterday, when (after "restarting" Python)
trying to open the very same file, it was normally opened with the same
method, with same text (input):</DIV>
<DIV> </DIV>
<DIV>>>> inp = open("lll.txt","r")</DIV>
<DIV>>>> outp = open("ggg","w")</DIV>
<DIV> </DIV>
<DIV>... but today after closing Python, shuting down PC (sleeping 8 hours) and
trying to do the same thing again - there was the same (familiar) - "no
such file or directory: 'somename.txt'" error message !!</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>I have also tryed what Danny suggested, some other method to open file, and
typed:</DIV>
<DIV> </DIV>
<DIV>>>> inp = open("D:/Program
Files/Python/Lib/idlelib/Saves/ggg.txt") ... and the file was opened normally
!!</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>... but in the very next line (of course after typing inp.close() ),
with inp = open("somefile.txt","r") method:</DIV>
<DIV> </DIV>
<DIV>>>> inp = open("lll.txt","r") ... the was "no such file or
directory" error message again !!</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>2.) Second about reading/writing from/into file, I noticed (yesterday,
when I had luck and I could open file), that Python doesn't want to write from
one file to another, which is non-empty (though maybe also just in my case) and
also in file, which was already modified (something written in), changed from
outside Python, during current session (of course, I used inp(close) before
modified it) and even if this file was modified, and I later deleted that "new
added" text (again maybe just in my case).</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>2.) Then I would really like to know, if I open some file, already
process some line, and then miss-spell something, and some error message appears
- do I need to close both (inp and out) files, and start from the beginning, or
could I continue from the line before that error message ??</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><BR>3.) And as the last question, Alan.G's answer on my question about
"difference between different types of brackets", was:</DIV>
<DIV> </DIV>
<DIV>"{} indicate a dictionary. ... One item in the pair is the lookup key, the
other the return value." </DIV>
<DIV> </DIV>
<DIV>I am just curious - where is some "elemental" difference between dictionary
(in practical use) and simple variable, cause "One item in the pair is the
lookup key, the other the return value." - more or less resemble on variable
deffiniton ...</DIV>
<DIV><BR>Example: </DIV>
<DIV> </DIV>
<DIV>instance = "Actual usage of class" (here we have variable and its actual
value, stored in some location in RAM)</DIV>
<DIV> </DIV>
<DIV>... so here one item is also some sort of "lookup key", and the other "the
return value" ...</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>Sorry, I really have more "theoretical" questions now on the beginning of
learning how to programm, but it (answers here on Tutor list) really help me to
imagine how everything works.</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>P.S., I save all the answers I get, and you couldn't imagine (or you
probably do, but I just said so, cause it sounds nice), how helpfull is having
you answers saved somewhere, and when something is not so clear, just open those
files, and see what was doing wrong ...</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><BR>Thank you all, Tadey<BR></FONT></DIV></BODY></HTML>