Re: basic question on loop & type casting / list/str/array

2022-03-16 Thread Python
Kiran Kumar wrote: Hi. Pls check on below poython 3.9.x code & suggest how can i keep the string intactst in 2nd loop... ? these are aws ec2 ids Don't loop through it then. -- https://mail.python.org/mailman/listinfo/python-list

basic question on loop & type casting / list/str/array

2022-03-16 Thread Kiran Kumar
Hi. Pls check on below poython 3.9.x code & suggest how can i keep the string intactst in 2nd loop... ? these are aws ec2 ids >>> INSTANCE_ID = ['i-0dccf1ede229ce1','i-0285506fee62051'] >>> for i in INSTANCE_ID: ... print (i) ... i-0dccf1ede229ce1 i-0285506fee62051 >>> >>> >>> >>> for i in IN

Re: basic question on how "import" works

2019-01-20 Thread Cameron Simpson
On 19Jan2019 11:42, joseph pareti wrote: [*u23885@c009 3_NeuralNetworks]$ cat foo.py* from __future__ import print_function # Import MNIST data from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("/tmp/data/", one_hot=True) [u23885@c009 3_NeuralNetworks

basic question on how "import" works

2019-01-19 Thread joseph pareti
[*u23885@c009 3_NeuralNetworks]$ cat foo.py* from __future__ import print_function # Import MNIST data from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("/tmp/data/", one_hot=True) [u23885@c009 3_NeuralNetworks]$ when the above code is executed, equivale

Re: pygame basic question

2015-09-08 Thread Ian Kelly
On Tue, Sep 8, 2015 at 8:01 AM, Dave Farrance wrote: > "ast" wrote: > >>DISPLAYSURF = pygame.display.set_mode((400, 300)) >>pygame.display.set_caption('Hello World!') >> >>The first line opens a 400x300 pygame window. >>The second one writes "Hello World" on top of it. >> >>I am just wondering ho

Re: pygame basic question

2015-09-08 Thread Dave Farrance
"ast" wrote: >DISPLAYSURF = pygame.display.set_mode((400, 300)) >pygame.display.set_caption('Hello World!') > >The first line opens a 400x300 pygame window. >The second one writes "Hello World" on top of it. > >I am just wondering how function set_caption finds the windows >since the window's nam

Re: pygame basic question

2015-09-08 Thread Mark Lawrence
On 08/09/2015 11:14, Laura Creighton wrote: Try the pygame mailing list for that one. http://www.pygame.org/wiki/info?action=view&id=4890 Laura Or https://www.reddit.com/r/pygame -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark L

Re: pygame basic question

2015-09-08 Thread Laura Creighton
Try the pygame mailing list for that one. http://www.pygame.org/wiki/info?action=view&id=4890 Laura -- https://mail.python.org/mailman/listinfo/python-list

pygame basic question

2015-09-08 Thread ast
Hi DISPLAYSURF = pygame.display.set_mode((400, 300)) pygame.display.set_caption('Hello World!') The first line opens a 400x300 pygame window. The second one writes "Hello World" on top of it. I am just wondering how function set_caption finds the windows since the window's name DISPLAYSURF i

Re: Very basic question. How do I start again?

2014-08-21 Thread Igor Korot
Hi, On Thu, Aug 21, 2014 at 10:56 PM, Tim Roberts wrote: > Seymore4Head wrote: >> >>I want to give the computer 100 tries to guess a random number between >>1 and 100 picked by the computer. > > If it takes more than 7, you're doing it wrong... I think he meant: 100 runs of the script... Thank

Re: Very basic question. How do I start again?

2014-08-21 Thread Tim Roberts
Seymore4Head wrote: > >I want to give the computer 100 tries to guess a random number between >1 and 100 picked by the computer. If it takes more than 7, you're doing it wrong... -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- https://mail.python.org/mailman/listinfo/python-lis

Re: Very basic question. How do I start again?

2014-08-21 Thread Denis McMahon
On Thu, 21 Aug 2014 21:37:22 -0400, Seymore4Head wrote: > I want to give the computer 100 tries to guess a random number between 1 > and 100 picked by the computer. > > For the moment I am always using 37 as the random pick. I want to > change the pick to pick=random.randrange(1,100). The progr

Re: Very basic question. How do I start again?

2014-08-21 Thread Steven D'Aprano
Seymore4Head wrote: > I want to give the computer 100 tries to guess a random number between > 1 and 100 picked by the computer. > > For the moment I am always using 37 as the random pick. I want to > change the pick to pick=random.randrange(1,100). The program works as > expected until the com

Re: Very basic question. How do I start again?

2014-08-21 Thread Seymore4Head
On Fri, 22 Aug 2014 11:58:00 +1000, Chris Angelico wrote: >On Fri, Aug 22, 2014 at 11:37 AM, Seymore4Head > wrote: >> I want to give the computer 100 tries to guess a random number between >> 1 and 100 picked by the computer. >> > >Suggestion: Be up-front about this being a homework assignment. M

Re: Very basic question. How do I start again?

2014-08-21 Thread Chris Angelico
On Fri, Aug 22, 2014 at 12:13 PM, Seymore4Head wrote: > I tried puttingbreak_stmt ::= "break" at the point where I > want to start over:) ,but since there is no "start ove"r command, > I was happy to end the program. > > I get "invalid syntax so I triedbreak_stmt Ah, that's part

Re: Very basic question. How do I start again?

2014-08-21 Thread Seymore4Head
On Fri, 22 Aug 2014 11:55:58 +1000, Ben Finney wrote: >Seymore4Head writes: > >> The program works as expected until the computer gets a correct guess. >> I don't know what I should be doing to restart the program when >> pick=guess. > >There isn't a “restart the program” code we can give. But I

Re: Very basic question. How do I start again?

2014-08-21 Thread Chris Angelico
On Fri, Aug 22, 2014 at 11:37 AM, Seymore4Head wrote: > I want to give the computer 100 tries to guess a random number between > 1 and 100 picked by the computer. > Suggestion: Be up-front about this being a homework assignment. Most of us can tell anyway, and it's more honest that way :) So, si

Re: Very basic question. How do I start again?

2014-08-21 Thread Ben Finney
Seymore4Head writes: > The program works as expected until the computer gets a correct guess. > I don't know what I should be doing to restart the program when > pick=guess. There isn't a “restart the program” code we can give. But I think you need only something rather simpler: > while count <

Very basic question. How do I start again?

2014-08-21 Thread Seymore4Head
I want to give the computer 100 tries to guess a random number between 1 and 100 picked by the computer. For the moment I am always using 37 as the random pick. I want to change the pick to pick=random.randrange(1,100). The program works as expected until the computer gets a correct guess. I do

Re: Basic Question. Deploy new Master/Slave (M/S) datastore

2012-08-30 Thread Mark Lawrence
On 30/08/2012 23:32, Ylodis wrote: That is the question, where have I to write, and what have I to write. My old acount was tarot-gratis, the new account is tarot-gratis-hrd. What have I to write, where Google help says "myapp" ? Where should I write appcfg.py update 'myapp'/ Probably where

Re: Basic Question. Deploy new Master/Slave (M/S) datastore

2012-08-30 Thread Ylodis
That is the question, where have I to write, and what have I to write. My old acount was tarot-gratis, the new account is tarot-gratis-hrd. What have I to write, where Google help says "myapp" ? Where should I write appcfg.py update 'myapp'/ -- http://mail.python.org/mailman/listinfo/python-lis

Re: Basic Question. Deploy new Master/Slave (M/S) datastore

2012-08-30 Thread Terry Reedy
On 8/30/2012 11:51 AM, Ylodis wrote: Hi, I had an old and deprecated Master/Slave (M/S) datastore and I trying to pass its content to a new Master/Slave (M/S) datastore as is expained here : https://developers.google.com/appengine/docs/adminconsole/migration#Deploying_Your_New_HRD_Application

Re: Basic Question. Deploy new Master/Slave (M/S) datastore

2012-08-30 Thread Ylodis
I am trying to use a Google public storage that is managed in python. I do web developement, I have very litle idea about python, english is not my natural language and as you can see, I am very lost. I do not even now which group cold help me. The details of what I want to do are in the link.

Re: Basic Question. Deploy new Master/Slave (M/S) datastore

2012-08-30 Thread Mark Lawrence
On 30/08/2012 16:51, Ylodis wrote: Hi, I had an old and deprecated Master/Slave (M/S) datastore and I trying to pass its content to a new Master/Slave (M/S) datastore as is expained here : https://developers.google.com/appengine/docs/adminconsole/migration#Deploying_Your_New_HRD_Application Wh

Basic Question. Deploy new Master/Slave (M/S) datastore

2012-08-30 Thread Ylodis
Hi, I had an old and deprecated Master/Slave (M/S) datastore and I trying to pass its content to a new Master/Slave (M/S) datastore as is expained here : https://developers.google.com/appengine/docs/adminconsole/migration#Deploying_Your_New_HRD_Application Where it say I have to : "appcfg.py up

Re: Basic question about speed/coding style/memory

2012-07-23 Thread 88888 Dihedral
Chris Angelico於 2012年7月21日星期六UTC+8下午5時04分12秒寫道: > On Sat, Jul 21, 2012 at 5:33 PM, Jan Riechers > wrote: > > Block > > #-- > > if statemente_true: > > doSomething() > > else: > > doSomethingElseInstead() > > > > #--

Re: Basic question about speed/coding style/memory

2012-07-23 Thread 88888 Dihedral
Jan Riechers於 2012年7月21日星期六UTC+8下午3時33分27秒寫道: > Hello Pythonlist, > > I have one very basic question about speed,memory friendly coding, and > coding style of the following easy "if"-statement in Python 2.7, > but Im > sure its also the s

Re: Basic question about speed/coding style/memory

2012-07-21 Thread Devin Jeanpierre
On Sat, Jul 21, 2012 at 5:06 AM, Steven D'Aprano wrote: > So there is approximately 0.03 second difference per TWO MILLION > if...else blocks, or about 15 nanoseconds each. This is highly unlikely > to be the bottleneck in your code. Assuming the difference is real, and > not just measurement erro

Re: Basic question about speed/coding style/memory

2012-07-21 Thread Thomas 'PointedEars' Lahn
Jan Riechers wrote: > I have one very basic question about speed,memory friendly coding, and > coding style of the following easy "if"-statement in Python 2.7, but Im > sure its also the same in Python 3.x > > Block > #-- > if

Re: Basic question about speed/coding style/memory

2012-07-21 Thread Jan Riechers
On 21.07.2012 12:06, Steven D'Aprano wrote: But in general, you're worrying too much about trivia. One way or the other, any speed difference will be trivial. Write whatever style reads and writes most naturally, and only worry about what's faster where it actually counts. Notice that I try

Re: Basic question about speed/coding style/memory

2012-07-21 Thread Steven D'Aprano
On Sat, 21 Jul 2012 10:33:27 +0300, Jan Riechers wrote: > Hello Pythonlist, > > I have one very basic question about speed,memory friendly coding, and > coding style of the following easy "if"-statement in Python 2.7, but Im > sure its also the same in Python 3.x I ass

Re: Basic question about speed/coding style/memory

2012-07-21 Thread Andrew Berg
On 7/21/2012 3:13 AM, Jan Riechers wrote: > Cause, as I understand the interpreter chooses either the "else" (1st > block) or just proceeds with following code outside the if. If none of the if/elif statements evaluate to something true, the else block is executed. > So if there is some overhead

Re: Basic question about speed/coding style/memory

2012-07-21 Thread Chris Angelico
On Sat, Jul 21, 2012 at 5:33 PM, Jan Riechers wrote: > Block > #-- > if statemente_true: > doSomething() > else: > doSomethingElseInstead() > > #-- This means, to me, that the two options are peers - you do this or yo

Re: Basic question about speed/coding style/memory

2012-07-21 Thread Jan Riechers
On 21.07.2012 11:02, Andrew Berg wrote: On 7/21/2012 2:33 AM, Jan Riechers wrote: Block ... versus this block: ... Now, very briefly, what is the better way to proceed in terms of execution speed, readability, coding style? Using if/else is the most readable in the general sense. Using return (

Re: Basic question about speed/coding style/memory

2012-07-21 Thread Andrew Berg
On 7/21/2012 2:33 AM, Jan Riechers wrote: > Block > ... > versus this block: > ... > Now, very briefly, what is the better way to proceed in terms of > execution speed, readability, coding style? Using if/else is the most readable in the general sense. Using return (or break or continue as applica

Basic question about speed/coding style/memory

2012-07-21 Thread Jan Riechers
Hello Pythonlist, I have one very basic question about speed,memory friendly coding, and coding style of the following easy "if"-statement in Python 2.7, but Im sure its also the same in Python 3.x Block #-- if statemente_true: doSometh

Re: Basic question from pure beginner

2009-07-01 Thread alex23
Dennis Lee Bieber wrote: >         There is also the getpass module to play with! I don't think I've ever seen getpass, so thanks for pointing that out. Unfortunately, it wouldn't have helped the OP understand why his original code wasn't working ;) -- http://mail.python.org/mailman/listinfo/pyt

Re: Basic question from pure beginner

2009-07-01 Thread alex23
On Jul 2, 3:47 am, Scott David Daniels wrote: > And even simpler: >      PASSWORD = "qwerty" >      MAXRETRY = 3 >      for attempt in range(MAXRETRY): >          if raw_input('Enter your password: ') == PASSWORD: >              print 'Password confirmed' >              break # this exits the for

Re: Basic question from pure beginner

2009-07-01 Thread Scott David Daniels
Charles Yeomans wrote: Let me offer a bit of editing Finally, I'd remove correct_password_given from the loop test, and replace it with a break statement when the correct password is entered. password = "qwerty" correct_password_given = False attemptcount = 0 MaxAttempts = 3 while attemptc

Re: Basic question from pure beginner

2009-07-01 Thread Charles Yeomans
Let me offer a bit of editing. First, using the condition count != 3 is perhaps risky. A mistake or a change in logic in the loop body might result in an infinite loop. So instead I suggest while count < 3... Second, I'd suggest storing the value 3 in a variable with a name that descri

Re: Basic question from pure beginner

2009-07-01 Thread MRAB
sato.ph...@gmail.com wrote: I have been going through some Python Programming exercises while following the MIT OpenCourseWare Intro to CS syllabus and am having some trouble with the first "If" exercise listed on this page: http://en.wikibooks.org/wiki/Python_Programming/Conditional_Statements#

Re: Basic question from pure beginner

2009-07-01 Thread Bruno Desthuilliers
Scott David Daniels a écrit : (snip) And even simpler: PASSWORD = "qwerty" MAXRETRY = 3 for attempt in range(MAXRETRY): if raw_input('Enter your password: ') == PASSWORD: print 'Password confirmed' break # this exits the for loop print 'Access

Re: Basic question from pure beginner

2009-07-01 Thread Bruno Desthuilliers
Charles Yeomans a écrit : Please don't top-post (not corrected) Let me offer a bit of editing. First, using the condition count != 3 is perhaps risky. A mistake or a change in logic in the loop body might result in an infinite loop. So instead I suggest while count < 3... Second, I'd su

Re: Basic question from pure beginner

2009-07-01 Thread Bruno Desthuilliers
sato.ph...@gmail.com a écrit : Thank you for all of the help. With your assistance and help from the Python Tutor mailing list I was able to come up with the following code: password = "qwerty" correct_password_given = False guess = "0" You could just use None here: guess=None count = 0

Re: Basic question from pure beginner

2009-07-01 Thread sato.ph...@gmail.com
Thank you for all of the help. With your assistance and help from the Python Tutor mailing list I was able to come up with the following code: password = "qwerty" correct_password_given = False guess = "0" count = 0 while count != 3 and not correct_password_given : guess = raw_input("Enter you

Re: Basic question from pure beginner

2009-07-01 Thread alex23
On Jul 1, 3:38 pm, "sato.ph...@gmail.com" wrote: > I have been able to make the module quit after entering a password > three times, but can't get it to quit right away after the correct one > is entered.   Not with the code you pasted, you haven't. There's a missing colon on line 7 & line 9 isn'

Re: Basic question from pure beginner

2009-07-01 Thread Peter Otten
sato.ph...@gmail.com wrote: > I have been going through some Python Programming exercises while > following the MIT OpenCourseWare Intro to CS syllabus and am having > some trouble with the first "If" exercise listed on this page: > > http://en.wikibooks.org/wiki/Python_Programming/Conditional_S

Basic question from pure beginner

2009-07-01 Thread sato.ph...@gmail.com
I have been going through some Python Programming exercises while following the MIT OpenCourseWare Intro to CS syllabus and am having some trouble with the first "If" exercise listed on this page: http://en.wikibooks.org/wiki/Python_Programming/Conditional_Statements#If_Exercises I have been able

Re: Most Basic Question Ever - please help

2009-05-04 Thread seanm . py
On May 3, 12:22 am, CM wrote: > On May 2, 4:36 pm, seanm...@gmail.com wrote: > > > > > I am going to try posting here again with more detail to see if I can > > finally get my first program to work. > > > I am working on a MacBook Pro with OS X 10.4.11. I opened a new window > > in IDLE to create

Re: Most Basic Question Ever - please help

2009-05-02 Thread CM
On May 2, 4:36 pm, seanm...@gmail.com wrote: > I am going to try posting here again with more detail to see if I can > finally get my first program to work. > > I am working on a MacBook Pro with OS X 10.4.11. I opened a new window > in IDLE to create a file. The file had only one line of code and

Re: Most Basic Question Ever - please help

2009-05-02 Thread seanm . py
On May 2, 6:25 pm, John Machin wrote: > On May 3, 7:46 am, Dave Angel wrote: > > > > > seanm...@gmail.com wrote: > > > I am going to try posting here again with more detail to see if I can > > > finally get my first program to work. > > > > I am working on a MacBook Pro with OS X 10.4.11. I opene

Re: Most Basic Question Ever - please help

2009-05-02 Thread John Machin
On May 3, 7:46 am, Dave Angel wrote: > seanm...@gmail.com wrote: > > I am going to try posting here again with more detail to see if I can > > finally get my first program to work. > > > I am working on a MacBook Pro with OS X 10.4.11. I opened a new window > > in IDLE to create a file. The file h

Re: Most Basic Question Ever - please help

2009-05-02 Thread Dave Angel
seanm...@gmail.com wrote: I am going to try posting here again with more detail to see if I can finally get my first program to work. I am working on a MacBook Pro with OS X 10.4.11. I opened a new window in IDLE to create a file. The file had only one line of code and was saved as module1.py. I

Re: Most Basic Question Ever - please help

2009-05-02 Thread Stephen Hansen
> > IDLE 2.6.2 > >>> python module1.py > SyntaxError: invalid syntax > The ">>>" prompt is Python's interactive interpreter. Once you are here, you already are in python-- so typing "python" again is redundant and invalid. >From this prompt you type in python code. I have never used IDLE so can't

Most Basic Question Ever - please help

2009-05-02 Thread seanm . py
I am going to try posting here again with more detail to see if I can finally get my first program to work. I am working on a MacBook Pro with OS X 10.4.11. I opened a new window in IDLE to create a file. The file had only one line of code and was saved as module1.py. I saved it to Macintosh HD. T

Re: Very basic question

2008-12-23 Thread Sengly
Thank you very much everyone. Regards, -- Sengly -- http://mail.python.org/mailman/listinfo/python-list

Re: Very basic question

2008-12-23 Thread Bryan Olson
Sengly wrote: I can hack it by doing eval('1.0*12/5') but is there any better method? Where did you get the string? If you generated it, you might as well make one or both the operands float to begin with. If you got it as input, calling eval() on it is a world of security hurt. The right w

Re: Very basic question

2008-12-23 Thread Sion Arrowsmith
Sengly wrote: >I would like to calculate a string expression to a float. For example, >I have ('12/5') and I want 2.4 as a result. I tried to use eval but it >only gives me 2 instead of 2.5 py> from __future__ import division py> print eval('12/5') 2.4 py> print eval('12//5') 2 Or switch to 3.0

Re: Very basic question

2008-12-23 Thread John Machin
On Dec 23, 9:49 pm, Sengly wrote: > I can hack it by doing eval('1.0*12/5') but is there any better method? from __future__ import division -- http://mail.python.org/mailman/listinfo/python-list

Re: Very basic question

2008-12-23 Thread Sengly
I can hack it by doing eval('1.0*12/5') but is there any better method? -- http://mail.python.org/mailman/listinfo/python-list

Re: Very basic question

2008-12-23 Thread Aaron Brady
On Dec 23, 4:46 am, Sengly wrote: > Hello all, > > I would like to calculate a string expression to a float. For example, > I have ('12/5') and I want 2.4 as a result. I tried to use eval but it > only gives me 2 instead of 2.5 > > Help!!! > > Regards, > > Sengly >>> float('12')/float('5') 2.3999

Very basic question

2008-12-23 Thread Sengly
Hello all, I would like to calculate a string expression to a float. For example, I have ('12/5') and I want 2.4 as a result. I tried to use eval but it only gives me 2 instead of 2.5 Help!!! Regards, Sengly -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter- Possibly a basic question

2008-07-31 Thread joshdw4
On Jul 30, 6:48 pm, "Guilherme Polo" <[EMAIL PROTECTED]> wrote: > On Wed, Jul 30, 2008 at 6:33 PM,  <[EMAIL PROTECTED]> wrote: > >... > > ... > > The second option is to not create the root there, instead, make App > inherit Tk. I rarely see people doing this, but it works too. Here you > won't nee

Re: Tkinter- Possibly a basic question

2008-07-30 Thread Guilherme Polo
On Wed, Jul 30, 2008 at 6:33 PM, <[EMAIL PROTECTED]> wrote: > I hate to do this, but I've thoroughly exhausted google search. Yes, > it's that pesky root window and I have tried withdraw to no avail. I'm > assuming this is because of the methods I'm using. I guess my question > is two-fold. > 1) H

Re: Tkinter- Possibly a basic question

2008-07-30 Thread Russell Blau
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I hate to do this, but I've thoroughly exhausted google search. Yes, > it's that pesky root window and I have tried withdraw to no avail. I'm > assuming this is because of the methods I'm using. I guess my question > is two-fold. > 1) Ho

Tkinter- Possibly a basic question

2008-07-30 Thread joshdw4
I hate to do this, but I've thoroughly exhausted google search. Yes, it's that pesky root window and I have tried withdraw to no avail. I'm assuming this is because of the methods I'm using. I guess my question is two-fold. 1) How do I get rid of that window? 2) Any comments in general? I am just l

Re: Basic Question about Python WebServer File handling

2008-07-11 Thread Gabriel Genellina
En Thu, 10 Jul 2008 22:20:21 -0300, Alok Kumar <[EMAIL PROTECTED]> escribi�: I need to have a python webserver which can handle Get request from the clients and upload the *files* from 4 different directories. Can someone please point me what to exactly look for. Look at SimpleHTTPServer.py

Basic Question about Python WebServer File handling

2008-07-10 Thread Alok Kumar
Hi, I need to have a python webserver which can handle Get request from the clients and upload the *files* from 4 different directories. Can someone please point me what to exactly look for. Thanks you very much for this great help. Regards Alok Kumar -- http://mail.python.org/mailman/listinfo/

Answer: Re: Basic question

2008-02-13 Thread WILLIAM SCHMIDT
Thank you Guilherme Solution below: >>> "Guilherme Polo" <[EMAIL PROTECTED]> 2008-02-13 06:48 >>> 2008/2/13, WILLIAM SCHMIDT <[EMAIL PROTECTED]>: > In several places in the Python documentation I have run across an extra "r" > that I can not explain: > * > In sys.p

Re: Basic question

2008-02-13 Thread Chris
On Feb 13, 2:22 pm, "WILLIAM SCHMIDT" <[EMAIL PROTECTED]> wrote: > In several places in the Python documentation I have run across an extra "r" > that I can not explain: > > * > In sys.path after the open bracket: >sys.path = [r'd:\temp'] > > In the on line help

Re: Basic question

2008-02-13 Thread Guilherme Polo
2008/2/13, WILLIAM SCHMIDT <[EMAIL PROTECTED]>: > In several places in the Python documentation I have run across an extra "r" > that I can not explain: > > > * > In sys.path after the open bracket: >sys.path = [r'd:\temp'] > > In the on line help in the DATA

Basic question

2008-02-13 Thread WILLIAM SCHMIDT
In several places in the Python documentation I have run across an extra "r" that I can not explain: * In sys.path after the open bracket: sys.path = [r'd:\temp'] In the on line help in the DATA section (towards the end): >>> help('sys') Help on built-in modu

Re: Basic question

2007-05-14 Thread Max M
Dmitry Dzhus skrev: >> Actually I'm trying to convert a string to a list of float numbers: >> str = '53,20,4,2' to L = [53.0, 20.0, 4.0, 2.0] > > str="53,20,4,2" > map(lambda s: float(s), str.split(',')) > > Last expression returns: [53.0, 20.0, 4.0, 2.0] The lambda is not needed there, as float

Re: Basic question

2007-05-14 Thread Gabriel Genellina
En Mon, 14 May 2007 02:05:47 -0300, Alex Martelli <[EMAIL PROTECTED]> escribió: > Gabriel Genellina <[EMAIL PROTECTED]> wrote: >> But that's not the same as requested - you get a plain list, and the >> original was a list of lists: > Are we talking about the same code?! What I saw at the root of

Re: Basic question

2007-05-13 Thread Alex Martelli
Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Sat, 12 May 2007 20:13:48 -0300, Alex Martelli <[EMAIL PROTECTED]> > escribió: > > > Cesar G. Miguel <[EMAIL PROTECTED]> wrote: > >> --- > >> L = [] > >> file = ['5,1378,1,9', '2,1,4,5'] > >> str='' > >> for item in file: > >>

Re: Basic question

2007-05-13 Thread Gabriel Genellina
En Sat, 12 May 2007 20:13:48 -0300, Alex Martelli <[EMAIL PROTECTED]> escribió: > Cesar G. Miguel <[EMAIL PROTECTED]> wrote: >> --- >> L = [] >> file = ['5,1378,1,9', '2,1,4,5'] >> str='' >> for item in file: >> L.append([float(n) for n in item.split(',')]) > > The assignment

Re: Basic question

2007-05-13 Thread Cesar G. Miguel
On May 12, 8:13 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > Cesar G. Miguel <[EMAIL PROTECTED]> wrote: > > > On May 12, 3:40 pm, Dmitry Dzhus <[EMAIL PROTECTED]> wrote: > > > > Actually I'm trying to convert a string to a list of float numbers: > > > > str = '53,20,4,2' to L = [53.0, 20.0, 4.0,

Re: Basic question

2007-05-12 Thread sturlamolden
On May 12, 6:18 pm, "Cesar G. Miguel" <[EMAIL PROTECTED]> wrote: > Am I missing something? Python for loops iterates over the elements in a container. It is similar to Java's "for each" loop. for j in range(10): print j if(True): j=j+2 print 'interno',j Is equivalent to: int[

Re: Basic question

2007-05-12 Thread Alex Martelli
Cesar G. Miguel <[EMAIL PROTECTED]> wrote: > On May 12, 3:40 pm, Dmitry Dzhus <[EMAIL PROTECTED]> wrote: > > > Actually I'm trying to convert a string to a list of float numbers: > > > str = '53,20,4,2' to L = [53.0, 20.0, 4.0, 2.0] > > > > str="53,20,4,2" > > map(lambda s: float(s), str.split(','

Re: Basic question

2007-05-12 Thread Kirk Job Sluder
"Cesar G. Miguel" <[EMAIL PROTECTED]> writes: > I've been studying python for 2 weeks now and got stucked in the > following problem: > > for j in range(10): > print j > if(True): >j=j+2 >print 'interno',j > > What happens is that "j=j+2" inside IF does not change the loop > co

Re: Basic question

2007-05-12 Thread Cesar G. Miguel
On May 12, 3:40 pm, Dmitry Dzhus <[EMAIL PROTECTED]> wrote: > > Actually I'm trying to convert a string to a list of float numbers: > > str = '53,20,4,2' to L = [53.0, 20.0, 4.0, 2.0] > > str="53,20,4,2" > map(lambda s: float(s), str.split(',')) > > Last expression returns: [53.0, 20.0, 4.0, 2.0] >

Re: Basic question

2007-05-12 Thread Grant Edwards
On 2007-05-12, Dmitry Dzhus <[EMAIL PROTECTED]> wrote: > str="53,20,4,2" > map(lambda s: float(s), str.split(',')) There's no need for the lambda. map(float,str.split(',')) Does exactly the same thing. -- Grant Edwards grante Yow! I feel like I am

Re: Basic question

2007-05-12 Thread Grant Edwards
On 2007-05-12, Cesar G. Miguel <[EMAIL PROTECTED]> wrote: > Actually I'm trying to convert a string to a list of float numbers: > str = '53,20,4,2' to L = [53.0, 20.0, 4.0, 2.0] >>> str = '53,20,4,2' >>> [float(w) for w in str.split(',')] [53.0, 20.0, 4.0, 2.0] >>> map(float,str.split(',')) [

Re: Basic question

2007-05-12 Thread Dmitry Dzhus
> Actually I'm trying to convert a string to a list of float numbers: > str = '53,20,4,2' to L = [53.0, 20.0, 4.0, 2.0] str="53,20,4,2" map(lambda s: float(s), str.split(',')) Last expression returns: [53.0, 20.0, 4.0, 2.0] -- Happy Hacking. Dmitry "Sphinx" Dzhus http://sphinx.net.ru -- http:

Re: Basic question

2007-05-12 Thread Cesar G. Miguel
On May 12, 3:09 pm, Karlo Lozovina <[EMAIL PROTECTED]> wrote: > Cesar G. Miguel wrote: > > - > > L = [] > > file = ['5,1378,1,9', '2,1,4,5'] > > str='' > > for item in file: > >j=0 > >while(j > while(item[j] != ','): > > str+=item[j] > >

Re: Basic question

2007-05-12 Thread Karlo Lozovina
Cesar G. Miguel wrote: > - > L = [] > file = ['5,1378,1,9', '2,1,4,5'] > str='' > for item in file: >j=0 >while(j while(item[j] != ','): > str+=item[j] > j=j+1 >if(j>= len(item)): break > > if(str != ''): >L

Re: Basic question

2007-05-12 Thread Cesar G. Miguel
On May 12, 2:45 pm, Basilisk96 <[EMAIL PROTECTED]> wrote: > On May 12, 12:18 pm, "Cesar G. Miguel" <[EMAIL PROTECTED]> wrote: > > > > > I've been studying python for 2 weeks now and got stucked in the > > following problem: > > > for j in range(10): > > print j > > if(True): > >j=j+2 >

Re: Basic question

2007-05-12 Thread Basilisk96
On May 12, 12:18 pm, "Cesar G. Miguel" <[EMAIL PROTECTED]> wrote: > I've been studying python for 2 weeks now and got stucked in the > following problem: > > for j in range(10): > print j > if(True): >j=j+2 >print 'interno',j > > What happens is that "j=j+2" inside IF does not c

Re: Basic question

2007-05-12 Thread Dmitry Dzhus
> "j=j+2" inside IF does not change the loop > counter ("j") You might be not truly catching the idea of Python `for` statements sequence nature. It seems that will make things quite clear. > The suite may assign to the variable(s) in the target list; this >

Re: Basic question

2007-05-12 Thread Arnaud Delobelle
On May 12, 5:18 pm, "Cesar G. Miguel" <[EMAIL PROTECTED]> wrote: > I've been studying python for 2 weeks now and got stucked in the > following problem: > > for j in range(10): > print j > if(True): >j=j+2 >print 'interno',j > > What happens is that "j=j+2" inside IF does not ch

Re: Basic question

2007-05-12 Thread Karlo Lozovina
Cesar G. Miguel wrote: > for j in range(10): > print j > if(True): >j=j+2 >print 'interno',j > > What happens is that "j=j+2" inside IF does not change the loop > counter ("j") as it would in C or Java, for example. > Am I missing something? If you want that kind of behaviour

Re: Basic question

2007-05-12 Thread Gary Herron
Cesar G. Miguel wrote: > I've been studying python for 2 weeks now and got stucked in the > following problem: > > for j in range(10): > print j > if(True): >j=j+2 >print 'interno',j > > What happens is that "j=j+2" inside IF does not change the loop > counter ("j") as it would

Basic question

2007-05-12 Thread Cesar G. Miguel
I've been studying python for 2 weeks now and got stucked in the following problem: for j in range(10): print j if(True): j=j+2 print 'interno',j What happens is that "j=j+2" inside IF does not change the loop counter ("j") as it would in C or Java, for example. Am I missing so

Re: Basic question about sockets and security

2007-05-07 Thread Steve Holden
Dave Dean wrote: [socket security inquiry] One further point: everything I wrote for server sockets applies to client sockets too if there's a possibility they are interacting with a server that's been maliciously coded, or compromised in some way by an attacker. regards Steve -- Steve Hold

Re: Basic question about sockets and security

2007-05-07 Thread Steve Holden
Dave Dean wrote: > Hi all, > I'm just starting out in sockets/network programming, and I have a very > basic question...what are the 'security' implications of opening up a > socket? For example, suppose I've written a simple chat server and chat > client.

Basic question about sockets and security

2007-05-02 Thread Dave Dean
Hi all, I'm just starting out in sockets/network programming, and I have a very basic question...what are the 'security' implications of opening up a socket? For example, suppose I've written a simple chat server and chat client. The server opens a socket, listens on

Re: matplotlib basic question

2007-04-23 Thread Robert Kern
Pete Forman wrote: > Robert Kern <[EMAIL PROTECTED]> writes: > > > Colin J. Williams wrote: >>> I'm not sure that scipy has been updated to Python 2.5 > > ? scipy certainly works with 2.5. Are you referring to something > > else perhaps? > > Yes, the Python Enthought Edition was being discusse

Re: matplotlib basic question

2007-04-23 Thread Pete Forman
Robert Kern <[EMAIL PROTECTED]> writes: > Colin J. Williams wrote: > >> I'm not sure that scipy has been updated to Python 2.5 > > ? scipy certainly works with 2.5. Are you referring to something > else perhaps? Yes, the Python Enthought Edition was being discussed and it is currently based on

Re: matplotlib basic question

2007-04-20 Thread Tommy Grav
On Apr 20, 2007, at 3:49 PM, Robert Kern wrote: > Tommy Grav wrote: >> On Apr 20, 2007, at 2:44 PM, Robert Kern wrote: >>> Colin J. Williams wrote: >>> I'm not sure that scipy has been updated to Python 2.5 >>> ? scipy certainly works with 2.5. Are you referring to something >>> else perhaps?

Re: matplotlib basic question

2007-04-20 Thread Robert Kern
Tommy Grav wrote: > On Apr 20, 2007, at 2:44 PM, Robert Kern wrote: >> Colin J. Williams wrote: >> >>> I'm not sure that scipy has been updated to Python 2.5 >> ? scipy certainly works with 2.5. Are you referring to something >> else perhaps? > > A side question: Is there any plans of updating t

  1   2   >