Re: [Tutor] Keeping Dictonary Entries Ordered

2009-02-12 Thread Senthil Kumaran
On Thu, Feb 12, 2009 at 2:55 PM, Alan Gauld wrote: > But you need to have an order that will work with sorted(). > Its not just the order you add items to the dict. And yes algorithmically, there is No Requirement or I should say a good Use Case for a Dict to have sorted keys. More we work with

Re: [Tutor] urllib unquote

2009-02-17 Thread Senthil Kumaran
On Tue, Feb 17, 2009 at 1:24 PM, Norman Khine wrote: > Thank you, but is it possible to get the original string from this? What do you mean by the original string Norman? Look at these definitions: Quoted String: In the different parts of the URL, there are set of characters, for e.g. space cha

[Tutor] Exercises for Classes and OOP in Python

2009-02-22 Thread Senthil Kumaran
Hello, I am looking for a good material that would provide exercises (and possibly solutions to demo exercises) that illustrates the Object Oriented Programming constructs in Python. Can pointers? TIA, Senthil ___ Tutor maillist - Tutor@python.org h

Re: [Tutor] Formatting

2009-02-24 Thread Senthil Kumaran
On Wed, Feb 25, 2009 at 10:37 AM, prasad rao wrote: > > licenseRe = re.compile(r'\(([A-Z]+)\)( No. (\d+))?') Change that to: licenseRe = re.compile(r'\(([A-Z]+)\)\s*(No.\d+)?') It now works. Thanks, Senthil ___ Tutor maillist - Tutor@python.org ht

Re: [Tutor] Convert XML codes to "normal" text?

2009-03-03 Thread Senthil Kumaran
On Wed, Mar 4, 2009 at 11:13 AM, Eric Dorsey wrote: > I know, for example, that the > code means >, but what I don't know is > how to convert it in all my data to show properly? I Feedparser returns the output in html only so except html tags and entities in the output. What you want is to Unesca

Re: [Tutor] glob in order of the file numbers

2009-03-06 Thread Senthil Kumaran
2009/3/7 Emad Nawfal (عماد نوفل) : > import glob > for path in glob.iglob("*.temp"): >     infile = open(path) >     for line in infile: >         print line.strip() import glob files = sorted(glob.glob("*.temp")) for each in files: print open(each).read() Note couple of things: - glob.glob

Re: [Tutor] if inside if help python

2009-03-09 Thread Senthil Kumaran
> I have question  if we make if statement inside if  like cprogramming below > how to do  in python Indentation is the key here. It is very simple. x=1 y=2 if x == 1: print "inside first if" if x == 2: print "inside second if" -- Senthil ___

Re: [Tutor] How to send an email using Python

2009-03-10 Thread Senthil Kumaran
Hello Samuel, When sending through smtp.gmail.com you might need to starttls() and do a login() before sending. >>> import smtplib >>> headers = "From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n" %(from,to,subject) >>> message = headers + "Hello, How are you?" >>> mailserver = smtplib.SMTP('smtp.gmail.c

Re: [Tutor] How to make the difference between binary and text files ?

2009-04-04 Thread Senthil Kumaran
Hello Dominique, On Sat, Apr 4, 2009 at 6:07 AM, Dominique wrote: > I am developing a very small multi-platform app to search for a specific word > or > expression in files located in a drive or directory. > So I need to open files to search for the word. > > I read that opening a binary file as

Re: [Tutor] What language should I learn after Python?

2009-10-06 Thread Senthil Kumaran
On Tue, Oct 06, 2009 at 03:39:36PM -0400, Mark Young wrote: > I'm now fairly familiar with Python, so I'm thinking about starting to learn a > second programming language. The problem is, I don't know which to learn. I You have already got a lot of healthy advice in this thread. I would like to su

Re: [Tutor] saving output data in a file

2009-12-04 Thread Senthil Kumaran
On Fri, Dec 04, 2009 at 01:13:42PM +0530, Prasad Mehendale wrote: > I am a beginner. I want to save the output data of the following programme in > a file through the programme. Please suggest me the way. I am using Python > 2.3.3 on mandrake linux 10 and using "Idle" to save the output to a file

Re: [Tutor] urllib

2009-12-07 Thread Senthil Kumaran
On Mon, Dec 07, 2009 at 08:38:24AM +0100, Jojo Mwebaze wrote: > I need help on something very small... > > i am using urllib to write a query and what i want returned is 'FHI=128%2C128& > FLO=1%2C1' > The way to use urllib.encode is like this: >>> urllib.urlencode({"key":"value"}) 'key=value' >

Re: [Tutor] What is URL to online Python interpreter?

2009-12-17 Thread Senthil Kumaran
On Thu, Dec 17, 2009 at 09:32:44PM -0800, Benjamin Castillo wrote: > What is URL to online Python interpreter? Google could have helped you too. Anyways, http://shell.appspot.com/ -- Senthil ___ Tutor maillist - Tutor@python.org To unsubscribe or cha

Re: [Tutor] Thought of some other things.

2008-02-06 Thread Senthil Kumaran
On Feb 6, 2008 11:38 PM, Timothy Sikes <[EMAIL PROTECTED]> wrote: > > First off, I was running my script from my flash drive-That could have > caused something. Next, I have possible found something IN the > location where I ran the script, I found a pic_db.bat with stuff in it... It >

Re: [Tutor] NLTK

2009-01-15 Thread Senthil Kumaran
> Ishan Puri wrote: > Hi, > I have download NLTK for Python 2.5. It download automatically to > C:\Program Files\Python25\libs\site-packages\nltk. When I try to open a > module in python, it says that no such module exists. What do I need to do? There are ways to install the module in the si

Re: [Tutor] eval and floating point

2009-01-15 Thread Senthil Kumaran
On Thu, Jan 15, 2009 at 9:42 AM, Bill Campbell wrote: > Python does the Right Thing(tm) when dividing two integers, > returning an integer result. > Unless it is python 3k, in which integer division (single /) can result in float. Because int is a long by default. :-) -- Senthil __

Re: [Tutor] Python3.0 and Tkinter on ubuntu 8.10 HOWTO

2009-01-15 Thread Senthil Kumaran
stalled. Thanks, Senthil -- Senthil Kumaran O.R. http://uthcode.sarovar.org ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] single key ordered sequence

2009-01-15 Thread Senthil Kumaran
> Also, how to practically walk in reverse order in a list without > copying it (e.g. items[::-1]), > especially if i need both indexes and items (couldn't find with > enumerate()). > Are you looking for reversed()? The way you are doing it is probably OK. But it can be simplified thus: keys = [

Re: [Tutor] 2 & 4 or more spaces per indentation level..

2009-01-15 Thread Senthil Kumaran
On Thu, Jan 15, 2009 at 06:57:09PM -0700, Eric Dorsey wrote: >Working in IDLE on Windows Vista, I have one program that I set to have >2 character spacing (due to the levels of if's and while's going on -- >later my brother called this a bit of a code smell, ie. logic shouldn't >go

Re: [Tutor] Corpora

2009-01-15 Thread Senthil Kumaran
On Fri, Jan 16, 2009 at 9:11 AM, Ishan Puri wrote: > Hi, > I was wondering if anyone could tell me where I can get corpora > containing IMs, or blogs or any internet communication? This is kind of www.google.com And for IM's specifically, you can look at "Alice Bot" Project, the corpus will

Re: [Tutor] Best Python3000 Tutorial for Beginner

2009-01-17 Thread Senthil Kumaran
On Sun, Jan 18, 2009 at 8:34 AM, Ian Egland wrote: > Hello all, I just joined this mailing list. > > I am a beginner to programming in general and would really appreciate a > tutorial for Python3000 that at least covers the basics. I have tried Hello Ian, That is a nice reason to get started with

Re: [Tutor] cube root

2009-01-18 Thread Senthil Kumaran
On Mon, Jan 19, 2009 at 12:11 PM, Brett Wilkins wrote: > Hey Colin, > What you're running into here is the limited accuracy of floating point > values... Here the Python Documentation mentioning about the inherent limitations in dealing with floating point numbers: http://docs.python.org/tutoria

Re: [Tutor] passing unknown no of arguments

2009-02-05 Thread Senthil Kumaran
On Thu, Feb 5, 2009 at 1:37 PM, amit sethi wrote: > How do you pass arguments of unknown no. of arguments to a function. You use * operator ( indirection) in the function definition for arguments and you pass the variable number of number arguments as a list. For e.g. >>> def foo(*args): ...

Re: [Tutor] passing unknown no of arguments

2009-02-05 Thread Senthil Kumaran
On Thu, Feb 5, 2009 at 2:27 PM, Alan Gauld wrote: > In general you can't. You would need to have a Python interpreter > in your browser. Alan, I think he was referring to CGI programming. Given the nature of his first question. Well continuing the discussion further, I saw a post by Bret Cannon o

Re: [Tutor] beginning to code

2017-09-10 Thread Senthil Kumaran
> unindent does not match any outer indention level Means that your Intendentaion is not proper. You should align your print statement and rest to the same level as if statement. Use a proper editor that supports Python Syntax. On Sun, Sep 10, 2017 at 4:32 AM, Elmar Klein wrote: > Hi there, >