Re: [Tutor] Fwd: Need help returning a null/blank value when using string indexes

2013-08-28 Thread Dave Angel
On 27/8/2013 22:41, Robyn Perry wrote: > > part2 = (fragA[-7:-5] + '') > > But it asks me to use a string, not a blank space. part2 needs begin with > 'da' so I can produce 'Udacity' in Test Case 2, but needs to somehow end > with a null kind of value so I can produce 'Ucity' in Test Case 3. See

Re: [Tutor] Fwd: script in Raspberry pi python

2013-07-30 Thread Dave Angel
On 07/29/2013 10:42 PM, Kirk Bailey wrote: ok, I read linked article, then copied the perl script text, which bombs. The TEXT: * #!/usr/local/bin/perl -w** ** use strict;** ** ** while () {** ** s/\r\n/\n/;** ** print;** ** }* This works nicely, and all problems are solved. I tri

Re: [Tutor] Fwd: script in Raspberry pi python

2013-07-29 Thread Kirk Bailey
ok, I read linked article, then copied the perl script text, which bombs. The TEXT: * #!/usr/local/bin/perl -w** ** use strict;** ** ** while () {** ** s/\r\n/\n/;** ** print;** ** }* This works nicely, and all problems are solved. I tried to download the program using apt-get, b

Re: [Tutor] Fwd: script in Raspberry pi python

2013-07-29 Thread Kirk Bailey
originally edited on a windows box, then copied over with a usb stick. I suppose I better open it, copy it to mouse then paste it to a nw file- or what? Please advise. On 7/25/2013 3:45 PM, Walter Prins wrote: Hi, On 25 July 2013 19:45, Kirk Bailey > wrote

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Dave Angel
On 06/14/2013 03:59 PM, Matt D wrote: On 06/14/2013 03:14 PM, Dave Angel wrote: On 06/14/2013 10:48 AM, Matt D wrote: Hey, here is a snip of my code. #logger code-- # first new line #self.logfile.write('\n') # date and ti

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Matt D
On 06/14/2013 03:14 PM, Dave Angel wrote: > On 06/14/2013 10:48 AM, Matt D wrote: >> Hey, >> here is a snip of my code. >> >> #logger code-- >> # first new line >> #self.logfile.write('\n') >> # date and time >> #self.log

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Dave Angel
On 06/14/2013 10:48 AM, Matt D wrote: Hey, here is a snip of my code. #logger code-- # first new line #self.logfile.write('\n') # date and time #self.logfile.write('%s,'%(str(strftime("%

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Alan Gauld
On 14/06/13 15:37, Matt D wrote: There is a difference between where an error *occurs* and where an error is *detected*. got it. the error can be in the previous line. Yeah, or more. I've seen errors that originated 3 or 4 lines back from the reported location. So just remember that if you c

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Matt D
Hey, here is a snip of my code. #logger code-- # first new line #self.logfile.write('\n') # date and time #self.logfile.write('%s,'%(str(strftime("%Y-%m-%d %H:%M:%S", gmtime()

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Matt D
On 06/14/2013 10:27 AM, Alan Gauld wrote: > On 14/06/13 14:27, Matt D wrote: >> im sorry i dont get it. there is too many brackets in this lin: >> >> tmplist.append(field_values["nac"]) >> >> Thats where the error is > > No, that's where Python *detected* that an error existed. > The actual e

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Alan Gauld
On 14/06/13 14:27, Matt D wrote: im sorry i dont get it. there is too many brackets in this lin: tmplist.append(field_values["nac"]) Thats where the error is No, that's where Python *detected* that an error existed. The actual error is on the previous line. This is quite common, espe

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Steven D'Aprano
On 14/06/13 22:45, Matt D wrote: tmplist = [] tmplist.append((str(strftime("%Y-%m-%d %H:%M:%S", localtime( tmplist.append(field_values["nac"]) [...] When i run the code program dies like this: tmplist.append(field_values["nac"]) ^ SyntaxError: i

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Don Jennings
On Jun 14, 2013, at 9:27 AM, Matt D wrote: > im sorry i dont get it. there is too many brackets in this lin: > > tmplist.append(field_values["nac"]) > > Thats where the error is but i dont see too many brackets? Please don't top post. The error is not on this line, but on the previous

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Matt D
im sorry i dont get it. there is too many brackets in this lin: tmplist.append(field_values["nac"]) Thats where the error is but i dont see too many brackets? On 06/14/2013 08:56 AM, Flynn, Stephen (L & P - IT) wrote: > Not enough closing brackets on the previous line... or actually too

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-14 Thread Matt D
i am trying to figure a way to to use a list to log/print my data: # tmplist = [time, 'nac', 'tgid', 'source', 'dest', 'algid'] is what we want tmplist = [] tmplist.append((str(strftime("%Y-%m-%d %H:%M:%S", localtime( tmplist.append(field_values["nac"]) tmplis

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-13 Thread Dave Angel
On 06/13/2013 12:32 PM, Matt D wrote: On 06/13/2013 11:23 AM, Dave Angel wrote: On 06/13/2013 10:37 AM, Matt D wrote: On 06/13/2013 08:22 AM, Dave Angel wrote: On 06/13/2013 12:18 AM, Matt D wrote: Hey, line 202: self.logfile.write('%s,'%(str(f))) d does put the comma in properl

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-13 Thread Matt D
On 06/13/2013 11:23 AM, Dave Angel wrote: > On 06/13/2013 10:37 AM, Matt D wrote: >> On 06/13/2013 08:22 AM, Dave Angel wrote: >>> On 06/13/2013 12:18 AM, Matt D wrote: > > >>> >> Hey, >> line 202: self.logfile.write('%s,'%(str(f))) d >> does put the comma in properly bu

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-13 Thread Dave Angel
On 06/13/2013 10:37 AM, Matt D wrote: On 06/13/2013 08:22 AM, Dave Angel wrote: On 06/13/2013 12:18 AM, Matt D wrote: Hey, line 202: self.logfile.write('%s,'%(str(f))) d does put the comma in properly but, line 203: self.logfile.write('\n') was putting the newline after each value

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-13 Thread Matt D
On 06/13/2013 08:22 AM, Dave Angel wrote: > On 06/13/2013 12:18 AM, Matt D wrote: >> >> >> >>> >>> >> yes the .py file has TextCtrl fields that get there values from a >> pickled dictionary. Another peice of the code watches a thread for the >> pickle. this is why i didnt use a list. I have

Re: [Tutor] Fwd: Re: Need Help Modifying a wxPython GUI (scrolling display and logging)

2013-06-13 Thread Dave Angel
On 06/13/2013 12:18 AM, Matt D wrote: yes the .py file has TextCtrl fields that get there values from a pickled dictionary. Another peice of the code watches a thread for the pickle. this is why i didnt use a list. I have been unable to find a nice way to just make a list with the it

Re: [Tutor] Fwd: Difference between types

2013-05-31 Thread Prasad, Ramit
eryksun wrote: > > Also, when you post code remember to use less than 70 characters per > line. Gmail has a 'feature' to automatically hard wrap plain-text > messages at about 70 characters, which it applies *after* you send > (i.e. there's no indicator in the composer... brilliant). It is not th

Re: [Tutor] Fwd: QT Python: How to re-use the return value of fileDialog.openFileName() ?

2013-05-27 Thread SM
Thank you, for the details. On Mon, May 27, 2013 at 10:13 AM, eryksun wrote: > On Mon, May 27, 2013 at 9:45 AM, Matthew Ngaha > wrote: > > On Mon, May 27, 2013 at 2:14 PM, SM wrote: > > > >>But then I also had to use self.fileDialog from within the function. Not > >> sure how I could avoid us

Re: [Tutor] Fwd: QT Python: How to re-use the return value of fileDialog.openFileName() ?

2013-05-27 Thread eryksun
On Mon, May 27, 2013 at 9:45 AM, Matthew Ngaha wrote: > On Mon, May 27, 2013 at 2:14 PM, SM wrote: > >>But then I also had to use self.fileDialog from within the function. Not >> sure how I could avoid using fileDialog. >> > > No problem. to do it without the instance variable, you access its > m

Re: [Tutor] Fwd: QT Python: How to re-use the return value of fileDialog.openFileName() ?

2013-05-27 Thread SM
Yes, the following works. path = QtGui.QFileDialog.getOpenFileName() Thanks! On Mon, May 27, 2013 at 9:45 AM, Matthew Ngaha wrote: > On Mon, May 27, 2013 at 2:14 PM, SM wrote: > > >But then I also had to use self.fileDialog from within the function. Not > > sure how I could avoid using fileDi

Re: [Tutor] Fwd: QT Python: How to re-use the return value of fileDialog.openFileName() ?

2013-05-27 Thread Matthew Ngaha
On Mon, May 27, 2013 at 2:14 PM, SM wrote: >But then I also had to use self.fileDialog from within the function. Not > sure how I could avoid using fileDialog. > > Thanks. No problem. to do it without the instance variable, you access its method directly. so replace: path = self.fileDialog.getO

Re: [Tutor] Fwd: QT Python: How to re-use the return value of fileDialog.openFileName() ?

2013-05-27 Thread SM
Thanks! I defined a function, as you suggested, to call when the button was clicked. But then I also had to use self.fileDialog from within the function. Not sure how I could avoid using fileDialog. I also defined global variable (under the class) and assigned it to the filename, so I could access

Re: [Tutor] Fwd: Difference between types

2013-05-26 Thread Steven D'Aprano
On 25/05/13 02:52, Citizen Kant wrote: When I say "coding", anyone can think about what coding is in his own daily work, but that's not my way. I'll try to refine the concept: right now I'm learning, if I say "coding" I refer to what I type inside my file named learningpythoncode.py that, believe

Re: [Tutor] Fwd: Difference between types

2013-05-25 Thread eryksun
On Fri, May 24, 2013 at 2:53 PM, Albert-Jan Roskam wrote: > Why do I need to use a trailing comma to create a singleton > tuple? Without a comma it seems to mean "parenthesized single > object", ie the parentheses are basically not there. Here are some technical notes and references to augment th

Re: [Tutor] Fwd: Difference between types

2013-05-25 Thread Mark Lawrence
On 25/05/2013 15:56, Dave Angel wrote: On 05/25/2013 08:54 AM, Albert-Jan Roskam wrote: From: Dave Angel The empty tuple is specified with (). But for any tuple with one or more members, it's the commas that turn it into a tuple. The parens are not necessarily needed unless the

Re: [Tutor] Fwd: Difference between types

2013-05-25 Thread Dave Angel
On 05/25/2013 08:54 AM, Albert-Jan Roskam wrote: From: Dave Angel The empty tuple is specified with (). But for any tuple with one or more members, it's the commas that turn it into a tuple. The parens are not necessarily needed unless the statement is complex enough that we need

Re: [Tutor] Fwd: Difference between types

2013-05-25 Thread Steven D'Aprano
On 25/05/13 22:54, Albert-Jan Roskam wrote: From: Dave Angel So x = 3,4 makes a one-tuple out of 3 and 4. Dave means a two-tuple here. If you want a one-tuple (which is NOT a singleton), you need a silly-looking comma to specify it: So you say the term singleton is reserved to on

Re: [Tutor] Fwd: Difference between types

2013-05-25 Thread Albert-Jan Roskam
> From: Dave Angel >To: tutor@python.org >Sent: Friday, May 24, 2013 9:10 PM >Subject: Re: [Tutor] Fwd: Difference between types > > >On 05/24/2013 02:53 PM, Albert-Jan Roskam wrote: >> >> >>> A tuple is defined by commas, depending on context. Howev

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread Dave Angel
On 05/24/2013 02:53 PM, Albert-Jan Roskam wrote: A tuple is defined by commas, depending on context. However, parentheses are typically required because commas have low precedence. >>> 1, 2 + 3, 4 (1, 5, 4) >>> (1, 2) + (3, 4) (1, 2, 3, 4) An empty tuple is a special cas

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread Albert-Jan Roskam
> A tuple is defined by commas, depending on context. However, > parentheses are typically required because commas have low precedence. > >     >>> 1, 2 + 3, 4 >     (1, 5, 4) > >     >>> (1, 2) + (3, 4) >     (1, 2, 3, 4) > > An empty tuple is a special case: > >     >>> x = () >     >>> typ

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread Citizen Kant
It's perfect, even if I'm not able to understand everything that's stated there. Then 2.5 is Operators, and 2.6 is Delimiters, that also goes in the line of what I'm thinking about. Thanks for the "you seem to be talking about", coz I'm learning not by memory but trying to understand, and sometime

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread eryksun
On Fri, May 24, 2013 at 12:52 PM, Citizen Kant wrote: > They are values since they cannot be reduced by rewriting any further. You seem to be talking about the "atoms" of the language: identifiers, literals, parenthesized forms, displays, and so on. Please read sections 2.3 (identifiers), 2.4 (li

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread eryksun
On Fri, May 24, 2013 at 7:04 AM, Citizen Kant wrote: > Same happens with the tuple (100, 'value', 2); where parenthesis and semi > colon work as a rule, setting the shape of a value named tuple that's > different to the shape of a value named list. At the same time both shapes > are equal (since

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread Citizen Kant
When I say "coding", anyone can think about what coding is in his own daily work, but that's not my way. I'll try to refine the concept: right now I'm learning, if I say "coding" I refer to what I type inside my file named learningpythoncode.py that, believe it or not, starts with: # """After the

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread eryksun
On Fri, May 24, 2013 at 9:31 AM, Citizen Kant wrote: > Sorry. I'm not doing this on purpose, but I'm doing it anyway, so I'll check > how to fix it. You're replying with rich text, for which Gmail has a lot of its own custom CSS (e.g. the gmail_quote class). In Gmail I see the quoted text as a pu

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread Citizen Kant
Sorry. I'm not doing this on purpose, but I'm doing it anyway, so I'll check how to fix it. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread Steven D'Aprano
Citizen Kant, will you please fix your email quoting? As it is, you are plagiarizing me, by quoting me word for word without attribution or any hint that you are quoting me. Do you notice that everyone else quotes people by name, and prefixes their words with > quote marks? This is the normal

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread Dave Angel
On 05/24/2013 07:04 AM, Citizen Kant wrote: Are you referring to this definition? http://en.wikipedia.org/wiki/**Value_%28computer_science%29 Any chance you can fix your use of gmail to conform to the usual standards? It does it rig

Re: [Tutor] Fwd: Available characters

2013-05-22 Thread Jim Mooney
> The unicodedata module provides access to the Unicode database that Python > uses: > > http://docs.python.org/2/library/unicodedata#unicodedata.unidata_version That was really useful for another reason. After I checked and saw it was in DLLs, I investigated the other Python DLLs - which had her

Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-18 Thread Danny Yoo
Followup: compare the previous interpreter code with this revision: https://gist.github.com/dyoo/5415464 and you'll see how it becomes easier now to add new command types into the system. ___ Tutor maillist - Tutor@python.org To unsubscribe or cha

Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-18 Thread Danny Yoo
Ok, good. This is _much_ more realistic code, and demonstrates why seeing context is important. My suggestion to do it computationally is totally invalid here. :P There's a lot of variation here, due to the access paths through the JSON that you're walking. You're essentially defining a very l

Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-18 Thread Danilo Chilene
On Thu, Apr 18, 2013 at 2:52 PM, Alan Gauld wrote: > On 18/04/13 18:14, Danilo Chilene wrote: > > for command in commands: >> if arg in commands: >> print commands[command] >> else: >> print 'Invalid command' >> > > I don't understand what you are doing here? Its almos

Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-18 Thread Alan Gauld
On 18/04/13 18:14, Danilo Chilene wrote: for command in commands: if arg in commands: print commands[command] else: print 'Invalid command' I don't understand what you are doing here? Its almost a random selection mechanism? You print the command for every item in

Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-18 Thread Dave Angel
On 04/18/2013 01:14 PM, Danilo Chilene wrote: The following code has little to do with anything that happened before. So you should start a new thread for this new project. Below is the final code: import requests, json, sys r = requests.get('http://napmongo01.cvc.com.br:28017/_sta

Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-18 Thread Danilo Chilene
On Thu, Apr 18, 2013 at 10:31 AM, Dave Angel wrote: > On 04/18/2013 09:21 AM, Danilo Chilene wrote: > >> On Wed, Apr 17, 2013 at 8:21 PM, Dave Angel wrote: >> >> >>> -- Forwarded message -- >>> From: Danilo Chilene Date: Wed, Apr 17, 2013 at 2:17 PM Subject: Re:

Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-18 Thread Dave Angel
On 04/18/2013 09:21 AM, Danilo Chilene wrote: On Wed, Apr 17, 2013 at 8:21 PM, Dave Angel wrote: -- Forwarded message -- From: Danilo Chilene Date: Wed, Apr 17, 2013 at 2:17 PM Subject: Re: [Tutor] Sys.argv read parameters To: Danny Yoo Hello Danny, The part that is ch

Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-18 Thread Danilo Chilene
On Wed, Apr 17, 2013 at 8:21 PM, Dave Angel wrote: > > -- Forwarded message -- >> From: Danilo Chilene >> Date: Wed, Apr 17, 2013 at 2:17 PM >> Subject: Re: [Tutor] Sys.argv read parameters >> To: Danny Yoo >> >> >> Hello Danny, >> >> The part that is changing is just the sys.a

Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-17 Thread Dave Angel
-- Forwarded message -- From: Danilo Chilene Date: Wed, Apr 17, 2013 at 2:17 PM Subject: Re: [Tutor] Sys.argv read parameters To: Danny Yoo Hello Danny, The part that is changing is just the sys.argv[1] The vars will have always the same content. What I don't want is to hav

Re: [Tutor] Fwd: Which databases allow lists as record fields?

2013-03-24 Thread Alan Gauld
On 24/03/13 22:36, DoanVietTrungAtGmail wrote: I read your help (thanks, Peter and Alan) and thought that relational database technology didn't naturally map to my problem domain. Here, at each simulation timestep each entity has a run-time variable number of pointers to other entities. Represent

Re: [Tutor] Fwd: Which databases allow lists as record fields?

2013-03-24 Thread DoanVietTrungAtGmail
I read your help (thanks, Peter and Alan) and thought that relational database technology didn't naturally map to my problem domain. Here, at each simulation timestep each entity has a run-time variable number of pointers to other entities. Representing each entity as a table seems unwieldy to me.

Re: [Tutor] Fwd: converting upper case to lowercase and vice-versa

2013-03-15 Thread Peter Otten
Bod Soutar wrote: > mystring = "THIS is A string" > newstring = "" > for item in mystring: > if item.isupper(): > newstring += item.upper() > else: > newstring += item.lower() > > print newstring This does nothing the hard way as newstring and mystring are equal ;) If yo

Re: [Tutor] Fwd: Which databases allow lists as record fields?

2013-03-14 Thread Alan Gauld
On 14/03/13 01:39, DoanVietTrungAtGmail wrote: You don't. You create a second table to hold the list. Then in the second table you include be reference back to the first. assuming I do it that way, how to deal with variable-length list? Most lists have 10^3, but some can grow to perhaps

Re: [Tutor] Fwd: Which databases allow lists as record fields?

2013-03-14 Thread Peter Otten
DoanVietTrungAtGmail wrote: >> You don't. You create a second table to hold the list. >> Then in the second table you include be reference back to the first. >> > > I thought about that but thought it seemed a roundabout way. But assuming > I do it that way, how to deal with variable-length list?

Re: [Tutor] Fwd: Which databases allow lists as record fields?

2013-03-13 Thread DoanVietTrungAtGmail
I saw your (Chris') reply after replying to Alan. So, the answer from both of you is No, not native. I've just read that MySQL is free and has a data type called LONGTEXT storing up to 4x10^9 char. Hurrah! As to SQL Server, I've just read that it "could take a small independent company´s budget an

Re: [Tutor] Fwd: Which databases allow lists as record fields?

2013-03-13 Thread DoanVietTrungAtGmail
.. > You don't. You create a second table to hold the list. > Then in the second table you include be reference back to the first. > I thought about that but thought it seemed a roundabout way. But assuming I do it that way, how to deal with variable-length list? Most lists have 10^3, but some c

Re: [Tutor] Fwd: Which databases allow lists as record fields?

2013-03-13 Thread Chris Fuller
Use pickle to serialize the list, then use any DB that takes strings of arbitrary length. You will probably be frustrated if you seek a (useful) DB that has native support for such things. Cheers On Wednesday, March 13, 2013, Dave Angel wrote: > I presume you meant this for the tutor list. I

Re: [Tutor] Fwd: Which databases allow lists as record fields?

2013-03-13 Thread Alan Gauld
To elaborate on my above question, I mean: Which database (which a Python program can access) allows a record to have not just simple fields but also fields that are variable-length lists? You don't. You create a second table to hold the list. Then in the second table you include be reference

Re: [Tutor] Fwd: findall() returns tuples or string?

2013-03-07 Thread Charles Leviton
Thanks Devin. now I have a better understanding of what happens. Let me explore finditer- hearing for the first time. On Mon, Mar 4, 2013 at 8:47 PM, Devin Jeanpierre wrote: > On Mon, Mar 4, 2013 at 8:22 PM, Charles Leviton > wrote: > > I have some confusion regarding when findall returns a li

Re: [Tutor] Fwd: findall() returns tuples or string?

2013-03-06 Thread eryksun
On Thu, Mar 7, 2013 at 12:26 AM, suhas bhairav wrote: > As far as my understanding goes, re.findall without using "()" inside your > pattern will return you a list of strings when you search something similar > to the one shown below: > > a="Bangalore, India" > re.findall("[\w][\n]*",a) With resp

Re: [Tutor] Fwd: findall() returns tuples or string?

2013-03-06 Thread suhas bhairav
a list of tuples. The member of each tuple is a string. a="Amherst, Massachusetts"re.findall("(Am)(herst)",a)Output:- [('Am','herst')] So the above output is a list of tuples. Let me know if you any questions. RegardsSuhas > Date: Wed, 6 Mar 2013 12:55:

Re: [Tutor] Fwd: findall() returns tuples or string?

2013-03-06 Thread Albert-Jan Roskam
>> I have some confusion regarding when findall returns a list of strings >> and when it returns a list of tuples. >> Would appreciate an explanation. > >re is not my strongest suite but I'll have a go. > >My understanding of how findall works is that it returns a list of matches. If >groups are

Re: [Tutor] Fwd: findall() returns tuples or string?

2013-03-04 Thread Alan Gauld
On 05/03/13 01:22, Charles Leviton wrote: I have some confusion regarding when findall returns a list of strings and when it returns a list of tuples. Would appreciate an explanation. re is not my strongest suite but I'll have a go. My understanding of how findall works is that it returns a l

Re: [Tutor] Fwd: findall() returns tuples or string?

2013-03-04 Thread Devin Jeanpierre
On Mon, Mar 4, 2013 at 8:22 PM, Charles Leviton wrote: > I have some confusion regarding when findall returns a list of strings and > when it returns a list of tuples. > Would appreciate an explanation. If there are no groups, it returns a list of strings, where the strings are the whole match.

Re: [Tutor] Fwd: regarding saving data in ASCII format

2012-09-28 Thread Mark Lawrence
On 21/09/2012 14:20, Preeti Gaikwad wrote: Hello i am new user of python pls let me know how to save the data in ascii formate Suppose I hv two column data in x and y like x(:,-1) and y(:,0) then how to save this in [x(:,-1), y(:,0)]; and then save this in ascii or dat file? thanks a lot in ad

Re: [Tutor] Fwd: Running a script in the background

2012-09-02 Thread eryksun
On Sun, Sep 2, 2012 at 10:06 AM, Walter Prins wrote: > > nohup python myscript.py & > > Then you can close the terminal afterwards. "nohup" means"no hangup". > It tells the system that the python process launched as a result of > this command should not be terminated when its parent shell is > t

Re: [Tutor] Fwd: string to binary and back... Python 3

2012-07-19 Thread Prasad, Ramit
> > Just to show you your original message contained no indentation > > whatsoever. You might want to check your mail client settings and do > > some experiments to make sure that indentation spaces are let through > > unmolested and not stripped anywhere, otherwise the current little > > brouhaha

Re: [Tutor] Fwd: string to binary and back... Python 3

2012-07-19 Thread Jordan
On 07/19/2012 10:29 AM, Walter Prins wrote: > Hi, > > Just to show you your original message contained no indentation > whatsoever. You might want to check your mail client settings and do > some experiments to make sure that indentation spaces are let through > unmolested and not stripped anywh

Re: [Tutor] Fwd: Is this possible and should it be done?

2012-05-21 Thread Jordan
On 05/21/2012 07:24 PM, Alan Gauld wrote: > On 21/05/12 15:23, wolfrage8...@gmail.com wrote: > >> if any of these formats offer file locking with in them, ;et me say >> that better. Can I open a, as example, tar file and lock a file with >> in it, with out locking the entire tar archive? > > No a

Re: [Tutor] Fwd: Is this possible and should it be done?

2012-05-21 Thread Alan Gauld
On 21/05/12 15:23, wolfrage8...@gmail.com wrote: if any of these formats offer file locking with in them, ;et me say that better. Can I open a, as example, tar file and lock a file with in it, with out locking the entire tar archive? No and you probably shouldn't. If two users are accessing t

Re: [Tutor] Fwd: help

2012-04-30 Thread spawgi
What does your input look like? Please provide that information. Regards, - SWP On Mon, Apr 30, 2012 at 12:30 PM, viral shah wrote: > > > I want to print below matrix. > > can any one suggest me the method for the same > > 1 2 3 > 4 5 6 > 7 8

Re: [Tutor] Fwd: help

2012-04-30 Thread Mark Lawrence
On 30/04/2012 08:00, viral shah wrote: I want to print below matrix. can any one suggest me the method for the same 1 2 3 4 5 6 7 8 9 Thanks ___ Tutor maillist - Tutor@python.org To unsubscr

Re: [Tutor] Fwd: help

2012-04-30 Thread Alan Gauld
On 30/04/12 08:00, viral shah wrote: I want to print below matrix. can any one suggest me the method for the same 1 2 3 4 5 6 7 8 9 print ''' 1 2 3 4 5 6 7 8 9 ''' But I suspect yo

Re: [Tutor] Fwd: The results of your email commands

2012-04-24 Thread 叶佑群
于 2012-4-24 18:13, Joel Goldstick 写道: On Tue, Apr 24, 2012 at 4:11 AM, 叶佑群 wrote: Hi, all I have two block code as: Block 1: #.. pobj = subprocess.Popen (["passwd", user], stdout=subprocess.PIPE, stdin = subprocess.PIPE) password = password + "\n"

Re: [Tutor] Fwd: The results of your email commands

2012-04-24 Thread Joel Goldstick
On Tue, Apr 24, 2012 at 4:11 AM, 叶佑群 wrote: > Hi, all > >    I have two block code as: > > Block 1: >            #.. >            pobj = subprocess.Popen (["passwd", user], > stdout=subprocess.PIPE, stdin = subprocess.PIPE) >            password = password + "\n" >            pobj.stdin.write

Re: [Tutor] Fwd: Re: trouble placing code into wxpython

2012-02-02 Thread Steven D'Aprano
shane wrote: i was trying to put the math.py into a frame Ive watched many tutorials. But cant seem to find out how to or where to place the code the files I want combined are attached. Do you mean you want to show the code in the GUI? You need to know the location of the file, then read the

Re: [Tutor] Fwd: Re: trouble placing code into wxpython

2012-02-02 Thread Alan Gauld
On 02/02/12 06:56, shane wrote: i was trying to put the math.py into a frame Ive watched many tutorials. That sounds like you've been using video tutorials? Those are a good start but you are probably better using a written one and working through them doing the examples. You can try my GUI

Re: [Tutor] Fwd: how to sort the file out

2011-09-07 Thread lina
On Wed, Sep 7, 2011 at 2:57 PM, lina wrote: > On Wed, Sep 7, 2011 at 2:25 PM, Hugo Arts wrote: >> forgot to forward this to list, sorry. >> >> >> -- Forwarded message -- >> From: Hugo Arts >> Date: Wed, Sep 7, 2011 at 8:24 AM >> Subject: Re: [Tutor] how to sort the file out >> To

Re: [Tutor] Fwd: how to sort the file out

2011-09-07 Thread lina
On Wed, Sep 7, 2011 at 2:25 PM, Hugo Arts wrote: > forgot to forward this to list, sorry. > > > -- Forwarded message -- > From: Hugo Arts > Date: Wed, Sep 7, 2011 at 8:24 AM > Subject: Re: [Tutor] how to sort the file out > To: lina > > > On Wed, Sep 7, 2011 at 8:16 AM, lina wro

Re: [Tutor] Fwd: Re: largest palindrome number

2011-08-30 Thread Chris Fuller
I played around with this puzzle a bit. I made a palindrome function a bit like Bob's, only i iterated through the string (stopping at the first mismatch) instead of doing the whole thing at once. The rest of the code is even more amenable to speedups. The first thing I saw was the outer "i"

Re: [Tutor] Fwd: Assistance

2011-04-24 Thread Krystal Brosz
Hi Steve, thank you so much for your prompt reply. sorry i'm sending another email as i haven't learnt how to replly to the posts properly yet. I've had a go at implementing a list, but all i get is: It looks as though it is appending all three values together rather than seperatly.. Please enter

Re: [Tutor] Fwd: Assistance

2011-04-24 Thread Steven D'Aprano
Krystal Brosz wrote: Hi there, i'm struggling with a program, i feel like i am really close to getting it but i cannot find a way to use the target variables inside of a loop: I'm trying to get the program to ask the user, how many grades are you going to enter. Then i want to work out the aver

Re: [Tutor] Fwd: Python skipping if statement (Really simple code)

2011-04-16 Thread Sotiris Tsartsaris
this proceed = input(int("Do you want to see Renees hate in form of a > picture? ")) > if proceed == "yes": > > should be proceed = input("Do you want to see Renees hate in form of a picture? ") if proceed == "yes": cause you are checking for a yes or no but you convert the input

Re: [Tutor] Fwd: Python skipping if statement (Really simple code)

2011-04-15 Thread Peter Otten
Casey Key wrote: > -- Forwarded message -- > From: Casey Key > Date: Thu, Apr 14, 2011 at 4:02 PM > Subject: Python skipping if statement (Really simple code) > To: tu...@python.com > > > Hey im a newbie to python, but i made this test code. and it is just > skipping over the if

Re: [Tutor] Fwd: Need mentor

2010-08-09 Thread bob gailer
Exactly what do you want your mentor to do? -- Bob Gailer 919-636-4239 Chapel Hill NC ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Fwd: Need mentor

2010-08-09 Thread Luke Paireepinart
On Mon, Aug 9, 2010 at 1:32 AM, Ranjith Kumar wrote: > Hi all, > > I have described the theme of my project here, > Cheers > Ranjith, > This sounds kind of like homework. Is it homework? If not, where did you get this spec from? Thanks, -Luke ___ Tutor

Re: [Tutor] Fwd: HELP!

2010-06-28 Thread Lang Hurst
On 06/28/2010 01:36 PM, Chris wrote: My friend jacob had a question. I can't really answer it, but you guys can. Send you replies to him not me. Oh, and jacob, I'm forwarding you message to the Python Mailing list. Chris, I tried the py2exe thing again, but things are getting confusing... It

Re: [Tutor] Fwd: HELP!

2010-06-28 Thread Chris
On 06/28/2010 05:17 PM, Walter Prins wrote: On 28 June 2010 21:36, Chris http://g.nius.ck>@gmail.com > wrote: My friend jacob had a question. I can't really answer it, but you guys can. Send you replies to him not me. Oh, and jacob, I'm forwarding you message to th

Re: [Tutor] Fwd: HELP!

2010-06-28 Thread Walter Prins
On 28 June 2010 21:36, Chris wrote: > My friend jacob had a question. I can't really answer it, but you guys > can. Send you replies to him not me. Oh, and jacob, I'm forwarding you > message to the Python Mailing list. > > Hi Chris/Jacob, I'm not sure if it's just me, but I'd have been slightl

Re: [Tutor] Fwd: Learning python using Michael Dawson's book

2010-05-19 Thread Alan Gauld
I thought I had posted a reply on this but I don't see it in the archive... You should make sure your font is set to a mono-spaced variety for this kind of thing otherwise it gets very difficult to align everything... -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.m

Re: [Tutor] Fwd: Learning python using Michael Dawson's book

2010-05-19 Thread Peter
Thank you for the responses to my question. This was my first posting and future questions will be made "clearer" to the group. Joseph, I have a feeling you are correct about the spacing. I will try that. Its easy to just load the code file and see the result, but I will learn more if I type o

Re: [Tutor] Fwd: Learning python using Michael Dawson's book

2010-05-19 Thread Joseph Gulizia
I posted this two days ago (I thought to the list...but apparently not). I'm hopeful it helps in some way. I have the same book. Using a text editor and the underscore and dash keys and a few others...the program example is creating an ASCII art version on the words "Game Over". Type it manual

Re: [Tutor] Fwd: Learning python using Michael Dawson's book

2010-05-19 Thread Andre Engels
On Tue, May 18, 2010 at 5:14 AM, Luke Paireepinart wrote: > Forwarding. Peter use reply-all don't reply offlist please. > > -- Forwarded message -- > From: Peter > Date: Mon, 17 May 2010 10:08:47 -0400 > Subject: Re: [Tutor] Learning python using Michael Dawson's book > To: Luke P

Re: [Tutor] Fwd: Help on finding the 1000th prime

2009-11-16 Thread Shashwat Anand
You'r trying naive algorithm. Finding prime is one of basic elements of maths and programming. You may look at sieve of eratosthenesand sieve of atkin On Tue, Nov 17, 2009 at 3:35 AM, wrote: > > > Ke

Re: [Tutor] Fwd: Help on finding the 1000th prime

2009-11-16 Thread christopher . henk
Kent Johnson wrote on 11/16/2009 04:00:02 PM: > -- Forwarded message -- > From: Ray Holt > Date: Mon, Nov 16, 2009 at 1:55 PM > Subject: RE: [Tutor] Help on finding the 1000th prime > To: Kent Johnson > > > I hit the send button before I was ready. Here is the code that doesn'

Re: [Tutor] Fwd: Help on finding the 1000th prime

2009-11-16 Thread Modulok
Also watch things like letter case on stuff like 'Print' and 'While', they should instead be 'print' and 'while', (all lowercase). -Modulok- On 11/16/09, bob gailer wrote: > >> Here is the code that doesn't work. >> > > Thanks for posting the code. What "doesn't work" mean? > error messages? > u

Re: [Tutor] Fwd: Help on finding the 1000th prime

2009-11-16 Thread bob gailer
Here is the code that doesn't work. Thanks for posting the code. What "doesn't work" mean? error messages? unexpected results? or what? There are several problems in your code. - The candidates you are testing. Walk thru the program and list a few of them and see if you can determine that

<    1   2   3   4   5   >