Jun 3, 2009

Python (PyQt)

Am working with PyQt for my 4th year project, developing a UI for a software at the Dept. Engineering Science.

Situation: I wanted to open a file for reading, then write at a certain place in the file.

Problem: Couldn't read and write even with
f = open('myFilename.txt', 'r+')

Solution: After reading, can't simply do f.write.
Instead,
f.seek()
then,
f.write('My writing')