RE: Django as exemplary design
From: alex23 (I also think there's value to be gained in studying _bad_ code, too...) Oh, very true. And not just true for python. But, only if an 'expoert' points out why it is bad and provides an alternative. And saying things like, it isn't pyhonic or that such and such is a more pythonic way is NOT helpful. -- http://mail.python.org/mailman/listinfo/python-list
RE: Rounding up to the next 100
From: noydb If one has a floating number as a string, is there a spiffy way to round that string-number UP to the nearest 100? XstrNmbr = 3579.127893 -- would want to round that to 3600. What's wrong with round? round( XstrNmbr, -2 ) seems to do the trick. Or do you want to get rid of the decimal point as well? The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: Rounding up to the next 100
From: Arnaud Delobelle XstrNmbr = 3579.127893 I meant XstrNmbr = 3579.127893 round(float(XstrNmbr), -2) 3600.0 Ah, then you will need to cast it first. XstrNmbr = '3579.127893' round(float(XstrNmbr) ,-2) 3600.0 The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: Porn Addiction Solutions?
From: Dotan Cohen 2008/10/8 Support Desk [EMAIL PROTECTED]: I got a solution, cutt it off, and then Kill yourself. Cut what off? The OP is female. Are you sure about that? :) The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: You advice please
-Original Message- From: Calvin Spealman God forbid I try to make a joke. No kidding! As a lurker newbie, I don't mind one bit. Actually, I have yet to meet a person that codes in Ruby that doesn't also do Python. I have met many Python coders that have never even looked at Ruby. Your joke may have more truth in it than you realized. And upper management reads the *V*logs and believe the hype. We should be prepared to counter the argument. The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: Change PC to Win or Windows
From: Derek Martin The term PC is commonly used in English, in the United States and other English speaking countries, to mean a computer running Microsoft Windows. That isn't quite true. My kids are heading off to college and are in the market for laptops. The question they had for the salesman was if there was anything other than Vista available. I was so proud. His response was that they no longer bother with XP. Another customer suggested that they look at Apple and another customer suggested dual booting it with Ubuntu ( why not Fedora? ). I was shocked when I asked if either were in the field. Nope, a mechanic and doctor. While it might have been true that PCs were becoming synonymous with Windows boxes, I think that tide is heading back the other way. Particularly when I hear that the Apple boxes are becoming very popular as they work better with iPods and iPhones than does Windows. The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: Please unregister this mail-address out of mailing-list.
-Original Message- From: Hank @ITGroup I am writing this letter to unsubscribe this mail-address from python mail-list. -- http://mail.python.org/mailman/listinfo/python-list No problem, Hank. You will be officially off of this 'mail-list' after a visit to this site; http://mail.python.org/mailman/listinfo/python-list The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: Fwd: NUCULAR fielded text searchable indexing
From: Grant Edwards Anyway, I apologize for my attempt at humor, since it appears to have somehow offended. Why apologize? If someone doesn't like the name given to a piece of software by its author(s), screw them. If I find the software useful, I'll use it. Even if its called 'bouncingBetty'. Actually, I might try it, just because of the name, but you get my point. The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: Program inefficiency?
-Original Message- From: [EMAIL PROTECTED] the program works great except for one thing. It's significantly slower through the later files in the search then through the early ones... Before anyone criticizes, I recognize that that middle section could be simplified with a for loop... I just haven't cleaned it up... The problem is that the first 300 files take about 10-15 seconds and the last 300 take about 2 minutes... If we do more than about 1500 files in one run, it just hangs up and never finishes... Is there a solution here that I'm missing? What am I doing that is so inefficient? You did not mention the OS, but because you are using pathname\editfile.txt, it sounds like you are using an MS OS. From past experience with various MS OSes, I found that as the number of files in a directory increases the slower your process runs for each file. You might try putting these files into multiple sub-directories. The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: Program inefficiency?
-Original Message- From: stdazi On Sep 29, 6:07 pm, [EMAIL PROTECTED] wrote: You did not mention the OS, but because you are using pathname\editfile.txt, it sounds like you are using an MS OS. From past experience with various MS OSes, I found that as the number of files in a directory increases the slower your process runs for each file. how so? I said sounds like, which means I was guessing. In *nix ( the ones I know ), it would have been pathname/editfile.txt. But, it was the file extension that caught my eye. I had a project a while back that required a mass conversion of jpeg files and ran into what sounded like a similar problem. The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: Program inefficiency?
-Original Message- From: thebjorn On Sep 29, 9:32 pm, stdazi [EMAIL PROTECTED] wrote: On Sep 29, 6:07 pm, [EMAIL PROTECTED] wrote: You did not mention the OS, but because you are using pathname\editfile.txt, it sounds like you are using an MS OS. From past experience with various MS OSes, I found that as the number of files in a directory increases the slower your process runs for each file. how so? Not entirely sure why, but some of the ms docs allude to the fact that there is a linked list involved (at least for fat-style disks). Wow! Talk about defending one's self ( me ). I took stdazi's question to mean why I thought it was an MS OS issue. And, yes, you are correct about the linked-list. Although, I do not know if that was the reason for the my problem. The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: OT Annoying Habits (Was: when format strings attack)
::CLAP CLAP:: thank you! I have been in the newsgroups for over 12 years and I never cared about the top/bottom post silliness. All I care about is that the message is clearly written. Everything else is doggerel. -Original Message- From: Carroll, Barry Personally, I don't think top-posting is the most annoying newsgroup habit. I think it's making a big fuss about minor inconveniences. ::CLAP CLAP:: thank you! I have been in the newsgroups for over 12 years and I never cared about the top/bottom post silliness. All I care about is that the message is clearly written. Everything else is doggerel. The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: merits of Lisp vs Python
After 394 postings in this thread, you all have convinced me. I am dropping all of my python code and switching to Lisp. thank-you The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: v2.3, 2.4, and 2.5's GUI is slow for me
-Original Message- From: John Salerno I don't use IDLE too much anymore, just for quick tests, but Just curious. I have tried IDLE, but stopped using it after going through a few of the tutorials. I just type things in at the 'python' prompt, regardless of which platform I am working on; Linux, AIX or Windows. But, then again, my code winds up in a batch process or part of a web app. Is there something cool I am missing? The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: hundreds of seconds?
-Original Message- From: [EMAIL PROTECTED] How can I access partial seconds on the system clock? What is wrong with time.time()? import time time.time() 1160578386.0109401 time.time() 1160578386.87324 time.time() 1160578387.5790291 x = time.time() y = time.time() z = y-x z 4.6488111019134521 The difference between x and y is the number of seconds between 'polling's of the OS. There are some issues with precision. The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: python loops
-Original Message- From: Kay Schluehr python: while i length: i += 1 As AlbaClause had demonstrated you can iterate over indices as well using the for-statement and the range() function. But you can also combine iterating over elements and indices at the same time using the builtin enumerate() type: for i, item in enumerate((s1,s2)): print i,item 0 s1 1 s2 Newbie here. I thought the xrange was preferred? for x in xrange(length): But, I thought that was too obvious an answer and I was missing something. I tried your code but it would not work. Then I realized I was behind the times with python2.2 It works in, at least, python 2.4 The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: How do you use this list ?
-Original Message- From: Grant Edwards Actually having mailing lists send you mail is insane. Once upon a time, I would have agreed. However, it is becoming increasingly difficuilt to get to the newgroups directly from the workplace. The only recourse is to use the mailing lists, such as those provided by various sites, such as python.org. This might also account for why so many folks top post rather than bottom post as postings look like email. And in a corporate setting, most people use top posting for email, pushing the history down and out of the way. The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: John Bokma harassment
! ! -Original Message- From: John Bokma And ain't it cool that reporting Xah's abuse might stop both? -- John Bokma Freelance software developer Experienced Perl programmer: http://castleamber.com/ CRAP! I am not sure which of these idiots is worse; John or Xah. Although, judging from other folks' responses to Xah Lee's posts, there is some value. John's stuff is just pure crap. I wasn't going to support Xah, but, now, I think I will. BTW, I hate bottom posting, but I didn't want to start another flame war... The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: MSSQL LIKE and IN statements in ADO problem
huh? This seems to work just fine for me... name = '%raj%' test = SELECT * FROM tb_name WHERE firstname LIKE '%s' % name print test SELECT * FROM tb_name WHERE firstname LIKE '%raj%' -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] n.org]On Behalf Of gregarican Sent: Wednesday, January 18, 2006 11:34 AM To: python-list@python.org Subject: Re: MSSQL LIKE and IN statements in ADO problem Can't you get rid of the Create Parameter part and directly pass along the value you are looking for? Something like... name = 'raj' cmd.CommandText= \ SELECT * FROM tb_name WHERE firstname LIKE %%%s % name This way the value of the name variable gets passed along when the CommandText method is invoked. BTW, this looks too painfully much like Visual Basic than Python :-) Just kidding (kind of) -- http://mail.python.org/mailman/listinfo/python-list The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: Tuples
Well, it works for me and x is a list, not a tuple. Or am I reading too much into your subject line? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] n.org]On Behalf Of Tuvas Sent: Thursday, December 15, 2005 12:20 PM To: python-list@python.org Subject: Tuples Let's say I make a program something like follows: x=[] x.append([1,2,3]) x.append([4,5,6]) print x print x[0] print x[0][1] x[0][1]=5 Okay, everything works here as expected except the last line. Why won't this work? Thanks for the help! The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Which is worse, Xah's stuff or everyone's effing crap about it? And don't even get me started on that MS bashing or top posting nonsense
Actually, the continuous complaining and ranting about Xah's 'postings' are far worse than Xah's actual postings. I can filter his stuff to /dev/null. The drivel that follows is almost as bad as the moronic effluent about how extra-python things should be done or not be done or the legal notices that one's company tacks on at the end of messages. for x in ( 'Grow up', 'Shut up', ' and get a life' ): print 'Life could be good' -Original Message- From: every idiot on this list, now including me... Something I don't quite understand, if people think it is troll, just ignore it. What I see is that people are feeding it by commenting about either him or his post. I saw a number of threads ended up that way(like the rather long one about Microsoft). ___ The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: users of pycurl here?
How about doing an 'ls -la' once you have connected to the server? That returns a listing of the files with the size in bytes. -Original Message- From: Michele Simionato I am having a hard time in finding out how to retrieve information about the *size* of files I want to download from an FTP site. Should I send a QUOTE SIZE command to the ftp server or is there an easier way? ___ The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: Using command line args on Windows
I'll assume that you are not familiar with Windows, so forgive me if you know this. 1) Go to a command prompt. The location of this depends on which OS you are running. But, you can go to Start / Run... and type in cmd or command. This will give you a window with a 'DOS' prompt. 2) Type path=path;c:\python24\ c:\python24\ is where I have python installed. I won't get into how to make this permanent. 3) type python and you have the command line shell you know and love. If this does not work for you, let me know. Michael -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] n.org]On Behalf Of k8 Sent: Wednesday, October 05, 2005 4:39 PM To: python-list@python.org Subject: Using command line args on Windows Hello- I'm stuck on a Windows machine today and would love to fully play with and test a simple python script. I want to be able to type python myscript myarg somewhere. Is there anything out there to help me? My main concern is playing with the myarg in the sys.argv list. I've been mucking around with IDLE without much success. ___ The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: Plotting points to screen
Jason, YMMV = Your Mileage May Vary In other words, how well it works for you depends on a lot of things. You need to determine the suitability for a given task. :) Michael personal note to Randy Bush Don't like the legal notice at the end of my email? Too bad, you can stuff it where the sun don't shine. /personal note to Randy Bush -Original Message- From: Jason Sent: Monday, September 26, 2005 3:46 PM To: python-list@python.org Subject: Re: Plotting points to screen One question, that's twice in as many days that someone has said YMMV. What's it mean!? -- http://mail.python.org/mailman/listinfo/python-list ___ The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: HTML tags optimization
Maybe you can get some ideas over at http://validator.w3.org/docs/. At least they have the whole parser thing worked out. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] n.org]On Behalf Of DENG Sent: Friday, September 02, 2005 8:36 AM To: python-list@python.org Subject: HTML tags optimization hi all, i want to do some optimizations for HTML tags, ___ The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: how to join two Dictionary together?
update works like append for lists a = {} a['a']='a' a['c']='c' b={} b['b'] = 'b' c={} c.update(a) c.update(b) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] n.org]On Behalf Of DENG Sent: Tuesday, August 30, 2005 10:45 AM To: python-list@python.org Subject: how to join two Dictionary together? dict1={...something...} dict2={...somethind else ..} dict1 + dict2 that's does works ..:(, it's not like List... anyone can tell me how to get it? thanks in advance -- http://mail.python.org/mailman/listinfo/python-list ___ The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: Newbie Question
Tom, Well, as one newbie to another, I tried this; x = '22,44,66,88,asd,asd,23,43,55' y = eval(x) y (22, 44, 66, 88, 'asd,asd', '23,43,55') given that x some how comes from a single line in your file. BTW, do you get the tutor list as well? My guess is that the 'experts' over here might prefer that the newbies go over there for stuff like this. And now, a question for the experts. Does anyone have a pointer as to why my code might be dangerous? I get the feeling that eval might not be a 'good' ( safe ) thing to use. Michael -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] n.org]On Behalf Of Tom Strickland Sent: Friday, August 19, 2005 10:05 AM To: python-list@python.org Subject: Newbie Question I have a file that contains many lines, each of which consists of a string of comma-separated variables, mostly floats but some strings. Each line looks like an obvious tuple to me. How do I save each line of this file as a tuple rather than a string? Or, is that the right way to go? Thank you. Tom Strickland -- http://mail.python.org/mailman/listinfo/python-list ___ The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
a little trouble passing values to Oracle using bind variables
All, As the subject line says, I am having some trouble passing bind variables to Oracle. When I pass a printable string value, such as 'NM', I get data. When I try to pass a non-printable character, such as 'return' - chr(13), I get no data back. I can't simply make NactionCode = chr(13), as python would change the value of NactionCode to '\r' and Oracle sees this as a two byte character, and not chr(13). I have looked into how Oracle might accept something like '\x00' for chr(0), but to no avail. Any thoughts? thanks, Michael def goGetIt( NactivityDt, NactionCode ): dataQuery = '''select a, b, c from %s where activityDt = :NactivityDt and actionCode = :NactionCode order by %s ''' % ( schema.tableName ) dbm.cursor.execute(dataQuery, NactivityDt = activityDt, NactionCode = actionCode ) result = dbm.cursor.fetchall() return result NactivityDt = '12-apr-2005' NactionCode = 'NM' act1 = goGetIt( NactivityDt, NactionCode ) NactivityDt = '12-apr-2005' NactionCode = 'chr(13)' act2 = goGetIt( NactivityDt, NactionCode ) NactivityDt = '12-apr-2005' NactionCode = chr(13) act3 = goGetIt( NactivityDt, NactionCode ) ___ The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: Launch file in Notepad
try b1=c:/test.txt It seems to work for me on Windows 2000. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] n.org]On Behalf Of George Sent: Thursday, May 12, 2005 9:41 AM To: python-list@python.org Subject: Launch file in Notepad Newbie question: I'm trying to lauch Notepad from Python to open a textfile: import os b1=c:\test.txt os.system('notepad.exe ' + b1) However, the t of test is escaped by the \, resulting in Notepad trying to open c: est.txt. How do I solve this? (By the way, b1 comes from a command line parameter, so the user enters c:\test.txt as command line parameter.) George -- http://mail.python.org/mailman/listinfo/python-list ___ The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: How do I parse this ? regexp ?
From: [EMAIL PROTECTED] I want to remove the commas, and square brackets [ and ] characters and rewrite this whole line (and all the ones following in a text file where only space would be a delimiter. How do I do this ? If all you want to do to the data as you read in and write out a line, how about string.replace('[',' ')? x = 'as[df]as,df' x = x.replace(']',' ') x = x.replace('[',' ') x = x.replace(',',' ') ___ The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
rudeness was: Python licence again
Laszlo, Is it something like 'center' or 'color' for Americans and 'centre' or 'colour' for British people? Yes, exactly. (Sorry to be offtopic) No need to apologize. I started to read the postings on this list and was dismayed at the depth of rudeness on here. I thought that pythonistas might be a little more patient/tolerant. I guess I was wrong. I understood exactly what you wanted to say, I just didn't have an answer. I did find it amusing that the person who incorrectly corrected you, was in fact, incorrect. I wonder, how many others out there find that the documentation and references materials seem to be written for someone that already knows the answer, but are indecipherable, at times, for those that don't know the answer. thanks, Michael ___ The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE:
All, I have been going through the manuals and not having much luck with the following code. This is basically an issue of giving 'split' multiple patterns to split a string. If it had an ignore case switch, the problem would be solved. Instead, I have to code the following, which works fine for a single byte string. What can I do when I want to look for strings? test = 'A big Fat CAt' A = test.split('A') print A ['', ' big Fat C', 't'] a = [] for x in xrange(len(A)): ... tmp = A[x].split('a') ... for y in xrange(len(tmp)): ... a.append(tmp[y]) ... a ['', ' big F', 't C', 't'] It is odd about the help files, after I figure out how to do something, the help makes sense. Before hand is another story... Are there any others out there that share this misery? thanks, Michael ___ The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: trouble to print array contents using slice operator
print a[10:15] or print a[10:] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] n.org]On Behalf Of praba kar Sent: Saturday, April 16, 2005 10:28 AM To: python-list@python.org Subject: trouble to print array contents using slice operator Dear all, In Php array_slice function base we can print array contents as per our desire eg) $a = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15); $arr = array_slice($a,10,10); this function will print 11,12,13,14,15 But I try to print the same thing in python using slice operator eg) print a[10:10] This statement print [] empty array. How I need to get my desired output like php array_slice function? with regards Prabahar Yahoo! India Matrimony: Find your life partner online Go to: http://yahoo.shaadi.com/india-matrimony -- http://mail.python.org/mailman/listinfo/python-list ___ The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: newbie: dictionary - howto get key value
how about? test = 3 #find person with this number for x in xrange(len(phone.keys())): print x if phone[phone.keys()[x]] == test: print phone.keys()[x] break Being a newbie myself, I'd love a little critique on the above. Be kind as I don't know what else needs to be done in Gerhard's process. Of course, we could put this loop in a call and return the name -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] n.org]On Behalf Of G. Völkl Sent: Thursday, March 10, 2005 12:19 PM To: python-list@python.org Subject: newbie: dictionary - howto get key value Hello, I use a dictionary: phone = {'mike':10,'sue':8,'john':3} phone['mike'] -- 10 I want to know who has number 3? 3 -- 'john' How to get it in the python way ? Thanks Gerhard -- http://mail.python.org/mailman/listinfo/python-list ___ The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify me immediately by replying to this message and deleting it and all copies and backups thereof. Thank you. -- http://mail.python.org/mailman/listinfo/python-list