Re: file.seek() and file.tell() look inconsistent to me

2016-07-04 Thread Christian Heimes
On 2016-07-04 17:48, Marco Buttu wrote: > Hi all, > > if I open a file in text mode, do you know why file.seek() returns the > number of bytes, and file.tell() takes the number of bytes? I was > expecting the number of characters, like write() does: Your expectations are not correct. tell() and

Re: file.seek() and file.tell() look inconsistent to me

2016-07-04 Thread MRAB
On 2016-07-04 16:48, Marco Buttu wrote: Hi all, if I open a file in text mode, do you know why file.seek() returns the number of bytes, and file.tell() takes the number of bytes? I was expecting the number of characters, like write() does: >>> f = open('myfile', 'w') >>> f.write('aè') 2 It

file.seek() and file.tell() look inconsistent to me

2016-07-04 Thread Marco Buttu
Hi all, if I open a file in text mode, do you know why file.seek() returns the number of bytes, and file.tell() takes the number of bytes? I was expecting the number of characters, like write() does: >>> f = open('myfile', 'w') >>> f.write('aè') 2 It seems to me not consistent, and maybe