Re: [Tutor] characters

2010-03-31 Thread Alan Gauld
"Shurui Liu (Aaron Liu)" wrote In Python, could space be counted as a character same as a letter? In Python the fastest and most certain way to answer such questions is to try it at the >>> prompt. len('ab cd') # is it 4 or 5? 5 HTH, -- Alan Gauld Author of the Learn to Program web

Re: [Tutor] characters

2010-03-30 Thread Shurui Liu (Aaron Liu)
yeah, thank you! On Wed, Mar 31, 2010 at 1:41 AM, Christian Witts wrote: > Shurui Liu (Aaron Liu) wrote: >> >> In Python, could space be counted as a character same as a letter? >> >> > > len(...) >   len(object) -> integer >     Return the number of items of a sequence or mapping. > > As a space

Re: [Tutor] characters

2010-03-30 Thread Christian Witts
Shurui Liu (Aaron Liu) wrote: In Python, could space be counted as a character same as a letter? len(...) len(object) -> integer Return the number of items of a sequence or mapping. As a space is an item it will be counted. -- Kind Regards, Christian Witts _

[Tutor] characters

2010-03-30 Thread Shurui Liu (Aaron Liu)
In Python, could space be counted as a character same as a letter? -- Shurui Liu (Aaron Liu) Computer Science & Engineering Technology University of Toledo ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mai

Re: [Tutor] characters in python

2006-10-18 Thread Alan Gauld
"Gigs_" <[EMAIL PROTECTED]> wrote in message > here is the code: So where do you think you tell Python that you are using unicode strings? I'm no expert but I think, as a minimum you need: for i in S: S = S.replace(u'æ', u'ć') S = S.replace(u'è', u'č') S = S.replace(u'ð', u'đ') You might

Re: [Tutor] characters in python

2006-10-18 Thread Gigs_
Hugo Gonzalez M wrote: > >> I tried with unicode strings, but nothing. It says : unsoported > characters > >> > > They are supported. Are you using them literally in your code? Anything > other than ASCII or Latin-1 needs to be declared explicitly at the start > of the source code file. > > Ma

Re: [Tutor] characters in python

2006-10-18 Thread Hugo Gonzalez M
>> I tried with unicode strings, but nothing. It says : unsoported characters >> They are supported. Are you using them literally in your code? Anything other than ASCII or Latin-1 needs to be declared explicitly at the start of the source code file. Maybe you can use UTF-8 encoding. See:

Re: [Tutor] characters in python

2006-10-18 Thread Gigs_
here is the code: def changer(): """Changer from Serbian to Croatian for this letters: æ, è, ð in ć, č, đ """ whatfile = raw_input('Enter location of your file: ') # open and read file ofile = open(whatfile, 'r') S = ofile.read() ofile.close() # search file and replace æ, è in ć, č for i in S: S

Re: [Tutor] characters in python

2006-10-18 Thread Luke Paireepinart
Stanko wrote: > I tried with unicode strings, but nothing. It says : unsoported characters > Perhaps you could give us the code you were using? > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > >

Re: [Tutor] characters in python

2006-10-18 Thread Stanko
I tried with unicode strings, but nothing. It says : unsoported characters ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] characters in python

2006-10-18 Thread Luke Paireepinart
Stanko wrote: > Can python handle this characters: ć, č, š, đ, ž? > If can, How? > Unicode strings. > And how to change tab spaceing in idle? I tried in idle properties. I > have set it to 4 character but it's still 8. > The default is 4. If it's 8, find out who changed it and ask them to ch

[Tutor] characters in python

2006-10-18 Thread Stanko
Can python handle this characters: ć, č, š, đ, ž? If can, How? And how to change tab spaceing in idle? I tried in idle properties. I have set it to 4 character but it's still 8. Thanks! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mai