0
Gotoxy for files in python
Hey there! How can i write a string in a specific position in a file? For example, how can I write "hello" in coordinate (4,5)?
1 Réponse
+ 4
Use seek method of the file object. <file>.seek(offset) where offset is a zero based address of the file cursor. To go to beginning of file pass zero as offset. More about the seek method can be found at the following link:
https://docs.python.org/3/tutorial/inputoutput.html
Scroll down to find "7.2.1. Methods of File Objects"
Hth, cmiiw