Re: [Tutor] slicing a string

2010-09-08 Thread Sandip Bhattacharya
On Tue, Sep 7, 2010 at 1:49 PM, Roel Schroeven wrote: > > But remember that you can make it simpler if you simply don't specify > the start and end points: > 'hello'[::-1] > 'olleh' > While I know that idiom works, I haven't really found an explanation as to *why* it works that way. For a s

Re: [Tutor] slicing a string

2010-09-08 Thread Sandip Bhattacharya
On Thu, Sep 9, 2010 at 11:34 AM, Evert Rol wrote: > Read > http://docs.python.org/library/stdtypes.html#sequence-types-str-unicode-list-tuple-buffer-xrange > , note 5 (about one "page" down), which explicitly says "If i or j are > omitted or None, they become “end” values (which end depends on the

Re: [Tutor] test

2010-11-07 Thread Sandip Bhattacharya
On Sat, Nov 06, 2010 at 04:20:54PM +1100, Steven D'Aprano wrote: > Luke Paireepinart wrote: > >You don't get your own e-mails back. > > I do. > > Perhaps it's an option when you sign up? I think it is an irritating gmail-only "feature". I use a google apps domain and face the same issue. I see

Re: [Tutor] Better structure?

2005-02-02 Thread Sandip Bhattacharya
for x in string: if x in chars: string[i] = '' I just have a hangover from other languages, but I really wanted to know how Python handles iteration over a variable which is being changed within the loop itself. Is the "for" condition evaluated in every loop? - Sandip __

Re: [Tutor] Hex to Str - still an open issue

2005-02-05 Thread Sandip Bhattacharya
Tamm, Heiko wrote: Ok, thank you. Does anybody know how to convert a HEX into a BINARY? Just trying my hand out on python : To convert the value of i to binary: == i = 456 s = '' while i: s = str(i % 2) + s i/=2 print s = in case you have i in the form of

Re: [Tutor] Hex to Str - still an open issue

2005-02-05 Thread Sandip Bhattacharya
Liam Clarke wrote: Sandip - Just looking at this - i = 456 s = '' while i: s = str(i % 2) + s i/=2 This works, far simpler than mine, which is always infuriating, but my question is, how exactly? if I have the number 15, when it divides by 2, it will become 7. Yet no error is introduced

[Tutor] want recommendations for interfacing with postgresql

2005-02-07 Thread Sandip Bhattacharya
Hi! I am planning to work with postgresql and python for one of my projects. Which library module would you recommend for the job? I have seen: 1. http://www.pygresql.org (pgdb module) 2. http://initd.org/projects/psycopg1 Thanks, Sandip -- Sandip Bhattacharya*Puroga Technologies

[Tutor] Fwd: want recommendations for interfacing with postgresql

2005-02-07 Thread Sandip Bhattacharya
[Reposting. Didnt make it the first time - Sandip] Forwarded Message From: Sandip Bhattacharya <[EMAIL PROTECTED]> To: Python Tutor Mailing List Subject: want recommendations for interfacing with postgresql Date: Mon, 07 Feb 2005 20:39:27 +0530 Hi! I am planning to wor

[Tutor] Re: Data storage, SQL?

2005-02-12 Thread Sandip Bhattacharya
bution comes with a standalone command-line access program (sqlite) that can be used to administer an SQLite database and which serves as an example of how to use the SQLite library. [...] - Sandip -- Sandip Bhattacharya*Puroga Technologies * [EMAIL PROTECTED] Work: http://www.pur

Re: [Tutor] search through a list

2005-07-03 Thread Sandip Bhattacharya
nephish wrote: > LogList = open('home/nephish/Projects/Piv/logs/LogList.txt', 'r') > LogsRead = LogList.readlines() > > #see if there is a new log file. > for i in LogFiles: > if LogFiles[i] not in LogList: Don't you mean "if LogF

Re: [Tutor] OT python Licences

2005-07-12 Thread Sandip Bhattacharya
windows executables using py2exe, you should look at the licences of these libraries too. AFAIK, these two widgets are quite liberal in linking and there is no restrictions in making commercial apps with them. - Sandip -- Sandip Bhattacharya *Puroga Technologies * [EMAIL PROTECTED]

Re: [Tutor] Query dictionaries with sql-like syntax

2005-07-13 Thread Sandip Bhattacharya
a lot of related data. > Why dont you use python-sqlite to dump your data? You might need to modify your sql slightly(depending on your current db), but rest is all sql. - Sandip -- Sandip Bhattacharya *Puroga Technologies * [EMAIL PROTECTED] Work: http://www.puroga.com * Home/

Re: [Tutor] Tkinter Q's

2005-07-13 Thread Sandip Bhattacharya
*kw here denotes the name and height keywords. Therefore Frame.__init__ is called with: __init__(self,None, name="some name", height="100") Without **kw, there is no other way to send an arbitary number of parameters to Frame.__init__. - Sandip -- Sandip Bhatta

Re: [Tutor] OT python Licences

2005-07-13 Thread Sandip Bhattacharya
eing nit-picky (this is the 2nd time this day but on another > list!). :) - Sandip -- Sandip Bhattacharya *Puroga Technologies * [EMAIL PROTECTED] Work: http://www.puroga.com * Home/Blog: http://www.sandipb.net/blog PGP/GPG Signature: 51A4 6C57 4BC6 8C82 6A65 AE78 B1A1 2280 A12

Re: [Tutor] OT python Licences

2005-07-14 Thread Sandip Bhattacharya
python, (I am not sure but LGPL too?) licences provide this "freedom" (note the quote! Note the quote! :-P ) Before you snap my head off, let me clarify that by saying this I am NOT trying to promote closed source software. :) - Sandip -- Sandip Bhattacharya *Puroga Technologi

[Tutor] How can isfile really do what it claims

2007-10-26 Thread Sandip Bhattacharya
$ ls -l /usr/lib/xulrunner/libfreebl3.so lrwxrwxrwx 1 root root 20 2007-10-20 12:13 /usr/lib/xulrunner/libfreebl3.so -> ../nss/libfreebl3.so $ python Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 Type "help", "copyright", "c

[Tutor] Buffering in file.read()

2008-05-08 Thread Sandip Bhattacharya
file.read()? In that case, I can stop worrying about writing my own buffering logic and just read like I desire. - Sandip -- Sandip Bhattacharya ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How to replace the '\'s in a path with '/'s?

2011-07-30 Thread Sandip Bhattacharya
On Sat, Jul 30, 2011 at 10:28:11PM -0700, Richard D. Moores wrote: > File "c:\P32Working\untitled-5.py", line 2 >return path.replace('\', '/') >^ > SyntaxError: EOL while scanning string literal > Process terminated with an exit code of 1 The first backslash up