Python program to Reverse a single line of a text file
Given a text file. The task is to reverse a single line of user’s choice from a given text file and update the already existing file.
Input: Hello Geeks for geeks! User choice = 1 Output: Hello Geeks geeks! for Input: This is a geek Welcome to GeeksforGeeks GeeksforGeeks is a computer science portal User choice = 0 Output: geek a is This Welcome to GeeksforGeeks GeeksforGeeks is a computer science portal
Let’s suppose the text file looks like this –