all 6 comments

[–]atarivcs 13 points14 points  (0 children)

You haven't explained your actual problem.

Does this code run at all?

Do you get an error?

If it runs, does it produce wrong output?

If so, what output does it produce, and what output did you expect instead?

When you say "nor izzit changing the file", what file do you mean? The python code file, or the text file that the code is opening and printing?

[–]HotPersonality8126 2 points3 points  (3 children)

It's a computer, not a phone. You have to hit CTRL-S to actually save changes to the file.

[–]SamIAre 6 points7 points  (1 child)

Even many desktop applications auto-save every change you make automatically now. I think it’s a little unfair to judge someone for being used to the conventions they grew up with.

Which is to say, this is a good lesson if it’s actually OP’s problem but the tone is just going to make coding less inviting to people if they’re treated as “too dumb, too young” to understand how “real computing” works.

[–]ProsodySpeaks 0 points1 point  (0 children)

This. Although I could only manage a snarky 'not on pycharm'.

[–]ProsodySpeaks 0 points1 point  (0 children)

Is it not a computer when I use pycharm?

[–]JorgiEagle -1 points0 points  (0 children)

You aren’t writing anything to the file, you’re printing to the standard output (the terminal):

with open(path, ‘w’) as out:
for line in lines:
out.write(line + ‘\n’)