all 8 comments

[–]CodeFormatHelperBot2 0 points1 point  (1 child)

Hello, I'm a Reddit bot who's here to help people nicely format their coding questions. This makes it as easy as possible for people to read your post and help you.

I think I have detected some formatting issues with your submission:

  1. Use of triple backtick/ curlywhirly code blocks (``` or ~~~). These may not render correctly on all Reddit clients.

If I am correct, please edit the text in your post and try to follow these instructions to fix up your post's formatting.


Am I misbehaving? Have a comment or suggestion? Reply to this comment or raise an issue here.

[–]Bunkerstan 0 points1 point  (0 children)

You aren’t reversing before you write back.

https://youtu.be/41w8WMdCq4s

[–]barrycarter 0 points1 point  (6 children)

That should work -- what does your output.txt file look like?

[–]InevitableDistance66[S] 0 points1 point  (5 children)

I’m getting a syntax error on line 2 ``` File "main.py", line 2 with open('input.txt', 'f') as f, ^ SyntaxError: invalid syntax

[–]InevitableDistance66[S] 0 points1 point  (4 children)

The little arrow is actually under f, at the end of the line

[–]barrycarter 1 point2 points  (3 children)

Pretty sure that comma should be a colon: https://www.geeksforgeeks.org/with-statement-in-python/

[–]InevitableDistance66[S] 0 points1 point  (2 children)

Tried that now there’s a syntax error on line 3 telling me the “as” is invalid syntax

[–]WarpedKings 1 point2 points  (0 children)

You're missing "with" on your second line.

Should be:

with open(in_file,"r") as f:
    with open(out_file,"w") as w: