[Tutor] Help with a task

2018-04-12 Thread Aditya Mukherjee
, as I've heard from other students that they have over 200 lines. :) I've attached the premise of what the task is asking for, due in 2 days. Thank you in advance Aditya Mukherjee. ___ Tutor maillist - Tutor@python.org To unsubscri

Re: [Tutor] Problem with installing python

2015-06-05 Thread Aditya Shaw
I was trying to install Python 2.7 on my Windows 8.1(x64) PC and got the following error: "There is a problem with this Windows Istaller Package.A DLL required for this install to complete could not be run.Contact your support personnel or package vendor." Please help! _

[Tutor] help in TKINTER

2011-08-15 Thread aditya
. -- Regards Aditya ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Socket Programming issue

2011-06-21 Thread aditya
On Tue, Jun 21, 2011 at 12:45 PM, Alan Gauld wrote: > > "aditya" wrote > > > is that although the Vbscript writes the output to the file correctly but >> when the client sends the contents of the file to the server via socket , >> it >> sometimes pri

[Tutor] Socket Programming issue

2011-06-20 Thread aditya
ERVER.PY import socket host = "" port = 2 size = 1024 backlog=5 s=socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((host,port)) s.listen(backlog) while 1: client, addr =s.accept() data=client.recv(size) if data: print data else: print &q

Re: [Tutor] Communicating Between Programs Using Raw Inputs (con'd)

2011-06-18 Thread aditya
id of it because I couldn't find a sys.stdout.close() > command or any other std command that would help. > > Thanks! > > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > > -- Regards Aditya ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] os.system() problem

2008-02-05 Thread Aditya Lal
On 04/02/08 10:42 PM, "Eric Brunson" <[EMAIL PROTECTED]> wrote: > dave selby wrote: >> Hi all, >> >> I am not sure if this is a Python or bash issue :). >> >> In bash if I execute 'motion' with the following ... >> >> [EMAIL PROTECTED]:~/.kde/share/apps/kmotion$ motion &> /dev/null & >> [1] 10

Re: [Tutor] run in "deamon" mode?

2008-01-10 Thread Aditya Lal
> > > The simplest way to achieve this is as follows : $ nohup python myfile.py & Otherwise you need to become daemon from inside the program. fork(), setsid(), etc. - the normal C language method for becoming a daemon.. -- Aditya ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] lstrip removes '/' unexpectedly

2007-12-03 Thread Aditya Lal
t; s1 > > 'test/' > > ## > > > > Take a closer look at the documentation of lstrip, and you should see > that > > what it takes in isn't treated as a prefix: rather, it'll be treated as > a > > set of characters. > > > > But then the real bug is why does it not strip the trailing '/' in > 'test/' or the 'e' that is in your set? > > Thats because you called lstrip() and not strip() which will strip only from left side. -- Aditya ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] parsing an array

2007-11-15 Thread Aditya Lal
1.5 in i[1] etc? > Since the data is in columns in a text file or csv, I can't put 1.5 in the > same sublist as 2, and 6 in the same sublist as 1.5 to make things > easier. What can I do? > Thank you for your help. > > --

Re: [Tutor] parsing an array

2007-11-13 Thread Aditya Lal
On Nov 13, 2007 7:06 PM, bob gailer <[EMAIL PROTECTED]> wrote: > Aditya Lal wrote: > > [snip] > > > for i in a[:] will make i point to the elements of the list > To be more precise: > a[:] is a copy of the list > the for statement assigns each list element in t

Re: [Tutor] parsing an array

2007-11-12 Thread Aditya Lal
as a[i][j] a[i][j] *= 2 You can use this to modify the array content as well. But do exercise caution in case of length change. Or have I completely misunderstood your question ? -- Aditya ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Swapping variables ...

2007-11-09 Thread Aditya Lal
After quizzing newbies in C on swapping without 3rd variable, I found this to be really *cool* construct to swap :) x = 10 y = 20 x,y = y,x -- Aditya ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] repeated times

2007-11-04 Thread Aditya Lal
times. After you are done press ^D to come out of session. Everything of that session will be saved in the file . On Windows, you can probably build something like "script" in python. BTW, does your executable takes any user inputs ? -- Aditya ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] question re type()

2007-10-31 Thread Aditya Lal
On 10/31/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > > Aditya Lal wrote: > > On 10/29/07, *Kent Johnson* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> > wrote: > > > - Common Python practice is to prefer the least restrictive type > check > &

Re: [Tutor] perplexing error with shelve REVISED

2007-10-30 Thread Aditya Lal
D %s' % > goodkey > data[goodkey] = doc > print 'Successfully shelved XML document with ID %s' % goodkey > > params['id'] = badkey > url = baseurl + urllib.urlencode(params) > doc = minidom.parseString(urllib.urlopen(url).read()

Re: [Tutor] question re type()

2007-10-30 Thread Aditya Lal
On 10/29/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > > Aditya Lal wrote: > > or use types module > > > > import types > > > > if type(n) == types.IntType or type(n) == types.LongType : > > blah! > > A few notes: > - If you look at typ

Re: [Tutor] 'source' in python or preloading variables

2007-10-27 Thread Aditya Lal
gt; > [0, '3', '3', '3'] > > > > > > > > So, I am not properly getting rid of the list[0], is it something with > > the 'global' nature of the vairables... it looks like it's only changing > > locallly in my source

Re: [Tutor] More type() puzzlement

2007-10-27 Thread Aditya Lal
r maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > Hi Dick, I would expect that a type change will happen if there is a need. Hence if type(n) is already long it does not have to get converted to int to accommodate something small. I changed your program

Re: [Tutor] 'source' in python or preloading variables

2007-10-27 Thread Aditya Lal
er lvalue is array or something else. Anyway, you can initialize the variables as follows - for v in ['STN_id', ... ] : exec( 'global %s ; %s = [0]*5' % (v, v)) Unfortunately these variable need to be made global for them to be visible everywhere. HTH Aditya ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] 'source' in python or preloading variables

2007-10-27 Thread Aditya Lal
the command and all your variables are populated ... > exec(cmd) > > > Thanks, > > > > > > > Thanks! This is helpful.. I like the RE approach as it's conceivable to > > write a function... > > &g

Re: [Tutor] question re type()

2007-10-27 Thread Aditya Lal
n) == types.IntType or type(n) == types.LongType : blah! this comes handy especially for some unique conditions - like whether the function passed is a generator or a normal function (well I kinda had this problem ... :) ) ex. if type(f) == types.GeneratorType or type(f) == types.lambdaType

Re: [Tutor] 'source' in python or preloading variables

2007-10-27 Thread Aditya Lal
STN_id[1] is not the first element but the second element. But you can filter unwanted items from the list if you want as in - [ x for x in STN_id if x != 0 ] HTH Aditya On 10/27/07, John <[EMAIL PROTECTED]> wrote: > > I have a file sitelocations: > > STN_id[1]=AAA > STN

Re: [Tutor] trouble with if

2007-10-25 Thread Aditya Lal
> 15): > > > e = float(openoa) > > > #else: > > > #e = 1 > > > > Maybe you need a 'break' statement after 'e = float(openoa)'? > > > > As written, e will have whatever value is appropriate for the last > > line of your input file. > > > > -- > > John. > > > > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > -- Aditya ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] populating an array or using a dictionary

2007-10-21 Thread Aditya Lal
> with changes. > > > > Kent > > > > > > ---- > > > > ___ > > Tutor maillist - Tutor@python.org > > http://mail.python.org/mailman/listinfo/tutor > > > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > -- Aditya ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] 2 problems in a small script

2007-10-12 Thread Aditya Lal
r the > >first time, but haven't figured it out yet. Ulipad now has it built > >in, so I'd like to learn to use it it.. > > > >2) I'm not able to get the "for char in wordWithCommas:" loop to stop > >examining a wordWithCommas after it's

Re: [Tutor] 2 problems in a small script

2007-10-12 Thread Aditya Lal
So, even though you created a new variable lstB it was actually modifying lstA. HTH Aditya On 10/12/07, Dick Moores <[EMAIL PROTECTED]> wrote: > > At 11:25 PM 10/11/2007, Aditya Lal wrote: > >Hi Dick, > > > >You are deleting from the SAME list that you are traversing.

Re: [Tutor] 2 problems in a small script

2007-10-11 Thread Aditya Lal
final = [] for word in lstA : if wellFormed(word) : final.append(word) You can also look at documentation for filter function (which is now handled via list comprehension). finalList = filter( wellFormed, lstA ) or finalList = [ word for word in lstA if wellformed(word) ] HTH Aditya On

Re: [Tutor] How to speed up input/string parsing ...

2007-09-27 Thread Aditya Lal
n.readlines() for i in xrange(N) : print solve(lines[i]) I will start working on psyco ... though not sure what is it ? Thanks again Kent. Cheers Aditya On 9/27/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > > Aditya Lal wrote: > > > def rev(n) : >

[Tutor] How to speed up input/string parsing ...

2007-09-27 Thread Aditya Lal
ne something to improve input processing. Thanks Aditya ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] reading random line from a file

2007-07-20 Thread Aditya Lal
A bug: The function random.randint(a,b) include both ends i.e. b is also included. Thus for file with single line a=0,b=1 my algo will give an IndexError. Significance of number 4096 : file is stored in blocks of size 2K/4K/8K (depending upon the machine). file seek for an offset goes block by blo

Re: [Tutor] reading random line from a file

2007-07-19 Thread Aditya Lal
mMem(filename) getrandomline2("shaks12.txt") Caveat : It will still skip 1st line during random selection if its size exceed 4096 chars !! --- Aditya Lal <[EMAIL PROTECTED]> wrote: > An alternative approach (I found the Yorick's code > to > be too slow for large # of ca

Re: [Tutor] reading random line from a file

2007-07-19 Thread Aditya Lal
on OSX) Approach using enum approach : 12.2886080742 : for [100] iterations Approach using filename : 12.5682640076 : for [10] iterations Approach using file descriptor : 6.55952501297 : for [10] iterations Approach using class : 5.35413718224 : for [10] iterations I am attaching test progr