Re: [Tutor] Why difference between printing string typing its object reference at the prompt?

2012-10-11 Thread Alan Gauld
On 11/10/12 02:23, boB Stepp wrote: bytes have string methods as a convenience, such as find, split, and partition. They also have the method decode(), which uses a specified encoding such as utf-8 to create a string from an encoded bytes sequence. What is the intended use of byte types?

[Tutor] Python Editor/IDE was Why difference between printing string typing its object reference at the prompt?

2012-10-11 Thread Mark Lawrence
On 03/10/2012 04:15, boB Stepp wrote: After much diddling around I have finally settled on a text to study (Programming in Python 3, 2nd edition, by Mark Summerfield) and have defaulted to using IDLE, deferring worrying about editors/IDEs until I feel comfortable in Python. I've been using

Re: [Tutor] Why difference between printing string typing its object reference at the prompt?

2012-10-11 Thread eryksun
On Wed, Oct 10, 2012 at 9:23 PM, boB Stepp robertvst...@gmail.com wrote: aꘌꘌb = True aꘌꘌb True Ⅰ, Ⅱ, Ⅲ, Ⅳ, Ⅴ = range(1, 6) Ⅰ, Ⅱ, Ⅲ, Ⅳ, Ⅴ (1, 2, 3, 4, 5) Is doing this considered good programming practice? The examples were meant to highlight the absurdity of

Re: [Tutor] Why difference between printing string typing its object reference at the prompt?

2012-10-11 Thread Dave Angel
On 10/11/2012 04:40 AM, eryksun wrote: On Wed, Oct 10, 2012 at 9:23 PM, boB Stepp robertvst...@gmail.com wrote: . What is the intended use of byte types? bytes objects are important for low-level data processing, such as file and socket I/O. The fundamental addressable value in a computer

Re: [Tutor] Why difference between printing string typing its object reference at the prompt?

2012-10-11 Thread eryksun
On Thu, Oct 11, 2012 at 5:04 AM, Dave Angel d...@davea.name wrote: Actually, the upper limit for a decoded utf-8 character is at least 6 bytes. I think it's 6, but it's no less than 6. Yes, but what would be the point? Unicode only has 17 planes, up to code 0x10. It's limited by UTF-16.

Re: [Tutor] Why difference between printing string typing its object reference at the prompt?

2012-10-11 Thread Dave Angel
On 10/11/2012 05:21 AM, eryksun wrote: On Thu, Oct 11, 2012 at 5:04 AM, Dave Angel d...@davea.name wrote: Actually, the upper limit for a decoded utf-8 character is at least 6 bytes. I think it's 6, but it's no less than 6. Yes, but what would be the point? Unicode only has 17 planes, up

[Tutor] Files Merging

2012-10-11 Thread Sunil Tech
Hi all, Greetings to you... it been so helpful for me to go through your all mails support i wish it still continues. I have two text files. text1 contains This is from Text1 --- 1st line This is from Text1 --- 2nd line This is from Text1 --- 3rd line This is from Text1 --- 4th line This is

Re: [Tutor] Files Merging

2012-10-11 Thread Dave Angel
On 10/11/2012 07:13 AM, Sunil Tech wrote: Hi all, Greetings to you... it been so helpful for me to go through your all mails support i wish it still continues. I have two text files. text1 contains This is from Text1 --- 1st line This is from Text1 --- 2nd line This is from Text1

Re: [Tutor] Files Merging

2012-10-11 Thread Sunil Tech
i used zip(), but it gives me result in list of tuples format. But i don't get in a exact expect format (as mentioned) no loopings are allowed. On Thu, Oct 11, 2012 at 5:30 PM, Dave Angel d...@davea.name wrote: On 10/11/2012 07:13 AM, Sunil Tech wrote: Hi all, Greetings to you... it

Re: [Tutor] Files Merging

2012-10-11 Thread eryksun
On Thu, Oct 11, 2012 at 7:13 AM, Sunil Tech sunil.tech...@gmail.com wrote: text1 contains This is from Text1 --- 1st line text2 contains This is from Text2 --- 1st line i want result in text3 like This is from Text1 --- 1st line This is from Text2 --- 1st line but

Re: [Tutor] Files Merging

2012-10-11 Thread Joel Goldstick
On Thu, Oct 11, 2012 at 8:30 AM, eryksun eryk...@gmail.com wrote: On Thu, Oct 11, 2012 at 7:13 AM, Sunil Tech sunil.tech...@gmail.com wrote: text1 contains This is from Text1 --- 1st line text2 contains This is from Text2 --- 1st line i want result in text3 like This is from

Re: [Tutor] Files Merging

2012-10-11 Thread Sunil Tech
Thanks all for your immediate responses :) On Thu, Oct 11, 2012 at 6:20 PM, Joel Goldstick joel.goldst...@gmail.comwrote: On Thu, Oct 11, 2012 at 8:30 AM, eryksun eryk...@gmail.com wrote: On Thu, Oct 11, 2012 at 7:13 AM, Sunil Tech sunil.tech...@gmail.com wrote: text1 contains This is

Re: [Tutor] Python Editor/IDE was Why difference between printing string typing its object reference at the prompt?

2012-10-11 Thread Alan Gauld
On 11/10/12 08:56, Mark Lawrence wrote: an awesome difference to my productivity. Quite why I was happy to slag off Eclipse maybe six months ago I don't know. Does a good sized portion of humble pie make amends? Eclipse is a heavyweight tool designed for heavyweight problems. For the

[Tutor] need an explanation

2012-10-11 Thread Matthew Ngaha
i need help on 2 topics. 1) can someone please tell me what sys is doing, and why its using weird indexing? if __name__ == __main__: A_Class(*sys.argv[1:4]).A_Class_Method() is sys able to call methods? if so why does it need indexing if it uses * .

Re: [Tutor] need an explanation

2012-10-11 Thread Prasad, Ramit
Matthew Ngaha wrote: i need help on 2 topics. 1) can someone please tell me what sys is doing, and why its using weird indexing? if __name__ == __main__:     A_Class(*sys.argv[1:4]).A_Class_Method() is sys able to call methods? if so why does it need indexing if it uses * . Sys is a

Re: [Tutor] need an explanation

2012-10-11 Thread Dave Angel
On 10/11/2012 03:24 PM, Matthew Ngaha wrote: i need help on 2 topics. 1) can someone please tell me what sys is doing, and why its using weird indexing? if __name__ == __main__: A_Class(*sys.argv[1:4]).A_Class_Method() sys isn't being indexed. sys is a module (presumably you have an

Re: [Tutor] need an explanation

2012-10-11 Thread Mark Lawrence
On 11/10/2012 20:24, Matthew Ngaha wrote: i need help on 2 topics. 1) can someone please tell me what sys is doing, and why its using weird indexing? sys isn't doing anything and the weird indexing is called slicing. if __name__ == __main__: A_Class(*sys.argv[1:4]).A_Class_Method()

Re: [Tutor] need an explanation

2012-10-11 Thread Emile van Sebille
Matthew Ngaha wrote: i need help on 2 topics. 1) can someone please tell me what sys is doing, and why its using weird indexing? if __name__ == __main__: A_Class(*sys.argv[1:4]).A_Class_Method() sys is doing nothing -- argv in sys holds the command line arguments passed into python.

Re: [Tutor] need an explanation

2012-10-11 Thread Matthew Ngaha
Obviously a Monty Python fan as I see 3 methods :) lol i dont know what i was looking at.. yes its 3 methods sorry:( def __init__(self): self.zipping_directory = unzipped-{}.format(filename) Where did filename appear from above? sorry i didnt write everything. the init method

Re: [Tutor] need an explanation

2012-10-11 Thread Dave Angel
On 10/11/2012 04:48 PM, Matthew Ngaha wrote: Obviously a Monty Python fan as I see 3 methods :) lol i dont know what i was looking at.. yes its 3 methods sorry:( def __init__(self): self.zipping_directory = unzipped-{}.format(filename) Where did filename appear from above? sorry

Re: [Tutor] need an explanation

2012-10-11 Thread Prasad, Ramit
Matthew Ngaha wrote: [snip] @ DAVE.. you said sys is a module (presumably you have an import somewhere above this line). In the module, there's a list argv. the import statements are: import sys import os import shutil import zipfile so im guessing [sys, os, shutil, zipfile]  these

[Tutor] Question about language code

2012-10-11 Thread Dae James
Here is a example in Python v2.7.2 document: import locale loc = locale.getlocale() # get current locale # use German locale; name might vary with platform locale.setlocale(locale.LC_ALL, 'de_DE') However, the result of executing on my computer is: locale.setlocale(locale.LC_ALL, 'de_DE')

Re: [Tutor] Question about language code

2012-10-11 Thread eryksun
On Thu, Oct 11, 2012 at 11:12 PM, Dae James daeda...@126.com wrote: import locale loc = locale.getlocale() # get current locale # use German locale; name might vary with platform locale.setlocale(locale.LC_ALL, 'de_DE') This depends on the C runtime. For Windows, see MSDN: setlocale

Re: [Tutor] Question about language code

2012-10-11 Thread eryksun
On Fri, Oct 12, 2012 at 12:37 AM, eryksun eryk...@gmail.com wrote: For example (untested): locale.setlocale(locale.LC_ALL, 'German_Germany.1252') I got around to testing the above, and it works. Also, the Python docs say if [locale is] an iterable, it’s converted to a locale name using