« first day (2002 days earlier)      last day (2963 days later) » 
00:00 - 23:0023:00 - 00:00

11:00 PM
1 last thing, I would like to overwrite everything that was written in that file but I am using a for loop and thus, if I use open ("",w) it only prints 1 line (the last one) because it keeps overwritting it
any idea on how to fix it? maybe open it the first time with w, write nothing, close it and begin the process?
 
why not try that and see if it works?
 
Because it is not a clean way to do it
 
ok, why do you think that?
 
It is possible to write a lot of programs without functions but it wouldn't be clean and you would write a lot more lines
are you following?
 
no
 
11:04 PM
you can call functions, where in a program that you take away the function you would have to rewrite what was in the function bellow it
 
What does this have to do with trying things, or explaining in any way why you think your idea "is not a clean way to do it"?
 
Function makes it cleaner in some way (I know its no the only reason to use it)
I am sure my way works but I don't like it and I am sure there's another way that takes less code
a code that is designed to do that task perhaps
 
You can't get simpler than opening a file for writing and writing to it.
 
You didn't follow...
 
Not sure what you expect, nor why you think 2 actions is "unclean"
 
11:06 PM
my scripts writes to the file with a for eachitem in file
if I use "w" as argument for open it would only prints 1 line
 
if you open for writing, you can't read from it
is this your problem?
 
if I use "a" it would add lines each time I run the program
I want to overwrite the file each time I RUN the program
 
you're doing it wrong if it only prints 1 line
is your indentation OK?
 
@AndrasDeak garlic
 
yeah I know, I'm hopeless:P
 
11:08 PM
with open("reallist.txt","r") as f:
	line = 0
	for elem in f:
		if line !=30:
		    string = elem[:]
		    string = string.replace('\n', '/')
		    with open("WordLists.txt","a") as f1:
		    	f1.write("/"+string+"\n")
		    line +=1
 
Edit and press ctrl+k
 
the for loop overwrites each lines I have written before it
 
tabs ಠ_ಠ
 
^ :D
@Bob open the output in the same with statement as the input
just the way I linked to
that is clean
and it will also work:P
 
@AndrasDeak reading from an fp that you're writing to probably won't end well
 
11:12 PM
reallist.txt -> f
WordLists.txt -> f1
where's the clash?
 
if it's two files you're fine, didn't notice that
 
of course:)
you couldn't rerun your script otherwise, not in a sane way
the only issue now is that the second opening is embedded in a loop, so it will be reopened and reclosed for each iteration
 
thats it... that was so dumb by my part
the problem was that I was opening it at the wrong place
thanks again guys! peace
 
rhubarb
 
DSM
11:36 PM
Wow. Left my table at a food court in a mall for a few minutes: came back to find someone eating my food. She insisted it must have been a confusion of some kind. My response was that she didn't look confused, she looked afraid. Probably if your situation is so bad you're ready to pounce on someone else's food I should be sympathetic, but it was still annoying as hell.
 
what?
I mean...you left your food unattended? Yuck!
don't you have roofies where you live?:P
 
DSM
If I'm sufficiently likely to be poisoned in that fashion then poisoning must be so common I'm doomed anyway. I didn't do background checks on the cooks either.
 
Oh but it's completely different from a psychological point of view: the cook would poison an innocent person, while in the mall you can poison someone who had it coming
YMMV depending on development level of society:P
 
00:00 - 23:0023:00 - 00:00

« first day (2002 days earlier)      last day (2963 days later) »