Re: anagram finder / dict mapping question

2008-05-07 Thread dave
rtedword in mapdic: print line On 2008-05-07 19:25:53 -0600, "Kam-Hung Soh" <[EMAIL PROTECTED]> said: On Thu, 08 May 2008 11:02:12 +1000, dave <[EMAIL PROTECTED]> wrote: Hi All, I wrote a program that takes a string sequence and finds all the wo

Re: anagram finder / dict mapping question

2008-05-08 Thread dave
On 2008-05-07 19:25:53 -0600, "Kam-Hung Soh" <[EMAIL PROTECTED]> said: On Thu, 08 May 2008 11:02:12 +1000, dave <[EMAIL PROTECTED] t> wrote: Hi All, I wrote a program that takes a string sequence and finds all the wo rds inside a text file (one word per line)

Re: anagram finder / dict mapping question

2008-05-09 Thread dave
On 2008-05-09 18:53:19 -0600, George Sakkis <[EMAIL PROTECTED]> said: On May 9, 5:19 pm, [EMAIL PROTECTED] wrote: What would be the best method to print the top results, the one's that had the highest amount of anagrams??  Create a new histogram dict? You can use the max() function to fin

Re: newb loop problem

2008-08-14 Thread Dave
On Aug 13, 8:46 am, Sion Arrowsmith <[EMAIL PROTECTED]> wrote: > Dave <[EMAIL PROTECTED]> wrote: > >hitNum = 0 > >stopCnt = 6 + hitNum > >offSet = 5 > > >for i in range(0,10,1): > > The step argument to range defaults to 1: it's tidier to omit

Re: Speed of data structures in python

2006-03-13 Thread Dave
r had nothing to do with speed of data structures in python, but the way data was being consumed by opengl (and my absolute newbieness at opengl ;-) i hope this helps anyone who is learning similar material Dave On Sat, 11 Mar 2006 16:54:06 +1100, Steven D'Aprano <[EMAIL PROTECTED]>

Re: Loop Backwards

2006-03-15 Thread Dave
>> or (more perlish at first sight): >> for item in alist[::-1]: >> do_something_with(item) >No "or" here. The [::-1] version creates a whole new list in memory, >it's silly to believe both will behave equally (well, strictly speaking >they will, but one will use twice more memory than the othe

Getting .NET SDK to work with Python 2.4.2

2006-03-18 Thread Dave
I searched the usenet and some mail archives and tried various techniques, but I can't seem to get the .NET 2.0 SDK to work with python. I'm a total newbie when it comes to python installs. I downloaded the .NET 2.0 SDK and I have python 2.4.2 and im trying to install zope. So i go to the cmd and g

Re: Getting .NET SDK to work with Python 2.4.2

2006-03-18 Thread Dave
yea i have .net 1.1, but not the sdk. do i need the 1.1 SDK too? -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting .NET SDK to work with Python 2.4.2

2006-03-19 Thread Dave
Well i don't have the whole visual studio. I don't have 7 either, I have 8. I have VB and VC++ Express. If there is no way to download VS7, could someone point me to directions on how to build the extensions with mingw32? -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting .NET SDK to work with Python 2.4.2

2006-03-19 Thread Dave
So this means that I have to download .NET 1.1 SDK. Visual Studio 8 comes with msvcrt.lib, but im assuming it's the wrong version. -- http://mail.python.org/mailman/listinfo/python-list

Seek support for new slice syntax PEP.

2009-12-14 Thread Dave
Just as sets may now be written as {3,'hi'}, I propose that slices should be available using [start:end] syntax. Following example comes from projecteuler.net problem 166. The Numeric community would also like this, as would the general python user. The slice notation would require one ":" betwe

Using Python and Connecting to MySQL remotely WITHOUT MySQL installed on local computer

2010-11-17 Thread dave
http://sourceforge.net/projects/mysql-python/ Using this package, WITHOUT having MySQL installed on my Mac OS X, how can I use python to connect to a remote MySQL server? All of the tutorials mention having to download MySQL! -- http://mail.python.org/mailman/listinfo/python-list

troubles compiling pythonwebkit

2011-01-13 Thread Dave
Hello Python enthusiasts, I'm trying to install the "Python Webkit DOM Bindings" (http://www.gnu.org/software/pythonwebkit/) but am not successful. The trouble starts when trying to 'make' pywebkitgtk. I've tried the prepatched version and downloading and patching myself. In both case the 'm

unicode shutil.copy() changes a file name during copy?

2011-02-15 Thread dave
i'm on windows, using active python 2.7.1 i've written a script to copy a folder of files to dest folder.. one if the files in this folder has the section symbol (§, '\x15') as part of the file name shutil.copy(src_file, dst_file) "can't find the file specified" when it does the os.chmod() part,

Re: unicode shutil.copy() changes a file name during copy?

2011-02-16 Thread dave
i don't see an "active python 3.2" i see "3.1" and "Many 3rd-party modules and extensions that you may depend upon may not yet be available for Python 3. As a result you may want to continue to use Python 2 for the time being". and i depend on some 3rd party modules. no i really think it's someth

Re: unicode shutil.copy() changes a file name during copy?

2011-02-16 Thread dave
ah! an interesting point! hmm yes when i'm running parallels, both the source and destination are sortof "Network Drive"'s, they're actually my native mac drives (file system reported as "PrlSF"). In this situation all works well. the reported getfilesystemencoding() is 'mbcs' which is a convenie

Re: unicode shutil.copy() changes a file name during copy?

2011-02-16 Thread dave
ah! an interesting point! hmm yes when i'm running parallels, both the source and destination are sortof "Network Drive"'s, they're actually my native mac drives (file system reported as "PrlSF"). In this situation all works well. the reported getfilesystemencoding() is 'mbcs' which is a convenie

Re: unicode shutil.copy() changes a file name during copy?

2011-02-16 Thread dave
thanks to your hint about drive format, i contacted MacDrive and they confirmed it was an incorrect setting, i have since fixed the setting and all is working! not a python bug! thanks for the replies. -dave -- http://mail.python.org/mailman/listinfo/python-list

Re: Which non SQL Database ?

2011-02-21 Thread Dave
But I was amused to see claims that BDB wasn't concurrent (not true) or that there were products which were "BDB-like" (why not use the real thing?) so I thought that I would chime in. Good luck on your search. Regards, Dave -- http://mail.python.org/mailman/listinfo/python-list

Local variables persist across function calls

2010-05-15 Thread Dave
I've been writing Python for a few years now, and tonight I ran into something that I didn't understand. I'm hoping someone can explain this to me. I'm writing a recursive function for generating dictionaries with keys that consist of all permutations of a certain set. Here's the function: def ma

changing format of time duration.

2010-06-03 Thread dave
Quick question. I have to time stamps (now and now2). now = datetime.datetime.now(); now2 = datetime.datetime.now(); now2-now1 yields me a result in 0:00:00.11221 (H:MM:SS.) I wanted to know if there is a standard python method or a quick hack to add an extra zero in the beginning. So the r

Newbie question - running a command and looking at output

2009-07-18 Thread Dave
I'm trying to run a command (arch -k) and check if the value returned is 'sun4v' or not. kir...@t2:[~] $ arch -k sun4v In fact, I want to do 3 three things 1) Check if the system is Solaris. 2) If it is Solaris, check if 'arch -k' prints 'sun4v' 3) If both 1 and 2 are true, copy a file. Sin

Re: Newbie question - running a command and looking at output

2009-07-18 Thread Dave
Dave wrote: I'm trying to run a command (arch -k) and check if the value returned is 'sun4v' or not. kir...@t2:[~] $ arch -k sun4v In fact, I want to do 3 three things 1) Check if the system is Solaris. 2) If it is Solaris, check if 'arch -k' prints 'sun4v'

Anyone using python on Mint Linux ?

2010-09-12 Thread Dave
Just read that Mint is a fine version of Debian Linux. Any comments about python on this ? Thanks, Dave WB3DWE -- http://mail.python.org/mailman/listinfo/python-list

Appending data to a json file

2017-04-03 Thread Dave
ay to do that. The advice I have seen on the web is to load the data when the program starts, append the new user input to the list, then re-write the data file. Is that the best way, or is there a better way? Thanks, Dave -- https://mail.python.org/mailman/listinfo/python-list

Re: Appending data to a json file

2017-04-04 Thread Dave
On 04/04/2017 10:17 AM, Michael Torrie wrote: On 04/03/2017 11:31 PM, dieter wrote: Dave writes: I created a python program that gets data from a user, stores the data as a dictionary in a list of dictionaries. When the program quits, it saves the data file. My desire is to append the new

Re: Appending data to a json file

2017-04-04 Thread Dave
On 04/04/2017 01:50 PM, Rob Gaddi wrote: On 04/04/2017 10:23 AM, Dave wrote: I don't care for the idea of replacing the data file for every save. My preference would to append to the existing data file - makes more sense. However, that is not how json works. So, I'm conside

Re: use python to split a video file into a set of parts

2013-05-07 Thread Dave Angel
On 05/07/2013 07:15 AM, iMath wrote: I use the following python code to split a FLV video file into a set of parts ,when finished ,only the first part video can be played ,the other parts are corrupted.I wonder why and Is there some correct ways to split video files There are two parts to an

Re: Making safe file names

2013-05-07 Thread Dave Angel
On 05/07/2013 03:58 PM, Andrew Berg wrote: Currently, I keep Last.fm artist data caches to avoid unnecessary API calls and have been naming the files using the artist name. However, artist names can have characters that are not allowed in file names for most file systems (e.g., C/A/T has forwar

Re: Making safe file names

2013-05-07 Thread Dave Angel
On 05/07/2013 08:51 PM, Andrew Berg wrote: On 2013.05.07 19:14, Dave Angel wrote: You also need to decide how to handle Unicode characters, since they're different for different OS. In Windows on NTFS, filenames are in Unicode, while on Unix, filenames are bytes. So on one of those, you

Re: Why do Perl programmers make more money than Python programmers

2013-05-07 Thread Dave Angel
On 05/07/2013 09:11 PM, Benjamin Kaplan wrote: On May 7, 2013 5:42 PM, "Neil Hodgson" wrote: jmfauth: 2) More critical, Py 3.3, just becomes non unicode compliant, (eg European languages or "ascii" typographers !) ... This is not demonstrating non-compliance. It is comparing performan

Re: Making safe file names

2013-05-07 Thread Dave Angel
On 05/07/2013 09:28 PM, Neil Hodgson wrote: Andrew Berg: This is not a Unicode issue since (modern) file systems will happily accept it. The issue is that certain characters (which are ASCII) are not allowed on some file systems: \ / : * ? "< > | @ and the NUL character The first 9 are not

Re: Making safe file names

2013-05-07 Thread Dave Angel
On 05/07/2013 10:06 PM, Andrew Berg wrote: On 2013.05.07 20:28, Neil Hodgson wrote: http://support.microsoft.com/kb/74496 http://en.wikipedia.org/wiki/Nul_%28band%29 I can indeed confirm that at least 'nul' cannot be used as a filename. However, I add an extension to the file names to identify

Re: Making safe file names

2013-05-07 Thread Dave Angel
On 05/07/2013 11:40 PM, Steven D'Aprano wrote: These are all Unicode characters too. Unicode is a subset of ASCII, so anything which is ASCII is also Unicode. Typo. You meant Unicode is a superset of ASCII. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list

Re: Globally available I/O connection (K8055 I/O board)

2013-05-08 Thread Dave Angel
On 05/08/2013 04:50 PM, flex...@gmail.com wrote: I'm having a bit of an issue trying to make a globally available connection to my Velleman K8055 I/O board... I've documented my issue as best I can here: http://stackoverflow.com/questions/16449706/python-access-global-instance-of-connection

Re: Get filename using filefialog.askfilename

2013-05-08 Thread Dave Angel
On 05/08/2013 04:14 PM, cheirasa...@gmail.com wrote: El martes, 7 de mayo de 2013 23:53:32 UTC+2, Terry Jan Reedy escribió: On 5/7/2013 4:27 PM, cheirasa...@gmail.com wrote: Yeah. This is an answer. A lot of thanks. For a moment there, I thought you were being sarcastic, and ungra

Re: help on Implementing a list of dicts with no data pattern

2013-05-08 Thread Dave Angel
On 05/08/2013 07:47 PM, rlelis wrote: Hi guys, Please read this http://wiki.python.org/moin/GoogleGroupsPython. I'm working on this long file, where i have to keep reading and storing different excerpts of text (data) in different variables (list). Once done that i want to store in dicts t

Re: help on Implementing a list of dicts with no data pattern

2013-05-09 Thread Dave Angel
On 05/09/2013 05:57 AM, rlelis wrote: On Thursday, May 9, 2013 12:47:47 AM UTC+1, rlelis wrote: Hi guys, I'm working on this long file, where i have to keep reading and storing different excerpts of text (data) in different variables (list). Once done that i want to store in dicts the dat

Re: help on Implementing a list of dicts with no data pattern

2013-05-09 Thread Dave Angel
On 05/09/2013 10:33 AM, rlelis wrote: I apologize once again. Is my first post here and i'm getting used to the group as long as i get the feedback of my errors by you guys. I'm using Python 2.7.3 with no dependencies, i'm simply using the standard library. Here is the "big picture" of the scena

Re: help on Implementing a list of dicts with no data pattern

2013-05-09 Thread Dave Angel
On 05/09/2013 12:14 PM, rlelis wrote: On Thursday, May 9, 2013 12:47:47 AM UTC+1, rlelis wrote: @Dave Angel this is how i mange to read and store the data in file. data = [] # readdata f = open(source_file, 'r') for line in f: header = (line.strip()).lower() # con

Re: help on Implementing a list of dicts with no data pattern

2013-05-09 Thread Dave Angel
On 05/09/2013 05:22 PM, rlelis wrote: On Thursday, May 9, 2013 7:19:38 PM UTC+1, Dave Angel wrote: Yes it's a list of string. I don't get the NameError: name 'file_content' is not defined in my code. That's because you have the 3 lines below which we hadn't see

Re: in need of some help regarding my rock paper scissors game

2013-05-12 Thread Dave Angel
On 05/12/2013 03:33 PM, Alex Norton wrote: im new to python and im in the middle of making a RPS game for a college unit. i have used PyQt to create the GUI and i have received help regarding adding the code to the buttons. I'm not at all familiar with PyQT, but I have used other GUIs, and I'm

Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ]

2013-05-13 Thread Dave Angel
On 05/13/2013 06:53 PM, Mark Lawrence wrote: On 13/05/2013 22:17, Alister wrote: On Mon, 13 May 2013 19:28:29 +0100, Fábio Santos wrote: I think it is more readable. When doing more complicated statements I use != instead, but when it's a single test I prefer not … == It's a personal thing. I

Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ]

2013-05-13 Thread Dave Angel
On 05/13/2013 07:30 PM, Cameron Simpson wrote: On 13May2013 19:22, Dave Angel wrote: | On 05/13/2013 06:53 PM, Mark Lawrence wrote: | >I much prefer the alternative <> for != but some silly people insisted | >that this be removed from Python3. Just how stupid can you get? | | So w

Re: Python for philosophers

2013-05-13 Thread Dave Angel
On 05/13/2013 07:32 PM, Citizen Kant wrote: Am I getting closer to the point? Depends on whom you think you're talking to. Clearly, you've replied to yourself, and top-posted besides. That's not a conversation, it's a monologue. -- DaveA -- http://mail.python.org/mailman/listi

Re: Determine actually given command line arguments

2013-05-15 Thread Dave Angel
On 05/15/2013 08:24 AM, Roy Smith wrote: In article , Henry Leyh wrote: Is there a simple way to determine which command line arguments were actually given on the commandline, i.e. does argparse.ArgumentParser() know which of its namespace members were actually hit during parse_args(). I t

Re: Question re: objects and square grids

2013-05-15 Thread Dave Angel
On 05/15/2013 12:56 PM, Andrew Bradley wrote: Hello everyone. I am having a good time programming with Python 3.3 and Pygame. Pygame seems like the perfect platform for the kind of simple games that I want to make. Pygame indeed looks pretty good to me as well. But I haven't done anything w

Re: Question re: objects and square grids

2013-05-15 Thread Dave Angel
On 05/15/2013 02:14 PM, Andrew Bradley wrote: Please reply on the list, not privately, unless it's something like a simple thank-you. Typically, you'd do a reply-all, then delete the people other than the list itself. Or if you're using Thunderbird, you could just reply-list. > Thank you v

Re: Question re: objects and square grids

2013-05-15 Thread Dave Angel
Please put new comments AFTER the part you're quoting. In other words, don't top-post. Also please trim off the stuff that's no longer relevant, so people don't have to read through it all wondering where your implied comments are. On 05/15/2013 06:48 PM, Andrew Bradley wrote: ok, now I hav

Re: Question re: objects and square grids

2013-05-15 Thread Dave Angel
On 05/15/2013 08:53 PM, Andrew Bradley wrote: So now, how can I utilize this new grid list? Thank you for the help so far, I feel like the entire grid is now being worked out. -Andrew That's a Pygame question, and I told you at the beginning, I can't really help with that. I'd like t

Re: executing python scripts that are symlinked

2013-05-16 Thread Dave Angel
On 05/16/2013 03:48 AM, Charles Smith wrote: Hi. How can I say, from the cmd line, that python should take my CWD as my CWD, and not the directory where the script actually is? I have a python script that works fine when it sits in directory WC, but if I move it out of WC to H and put a symlin

Re: executing python scripts that are symlinked

2013-05-16 Thread Dave Angel
On 05/16/2013 04:29 AM, Charles Smith wrote: On 16 Mai, 10:18, Dave Angel wrote: On 05/16/2013 03:48 AM, Charles Smith wrote: Hi. How can I say, from the cmd line, that python should take my CWD as my CWD, and not the directory where the script actually is? I have a python script that

Re: spilt question

2013-05-16 Thread Dave Angel
On 05/16/2013 11:00 AM, loial wrote: I want to split a string so that I always return everything BEFORE the LAST underscore HELLO_.lst # should return HELLO HELLO_GOODBYE_.ls # should return HELLO_GOODBYE I have tried with rsplit but cannot get it to work. Any help ap

Re: spilt question

2013-05-16 Thread Dave Angel
On 05/16/2013 11:15 AM, Chris Angelico wrote: On Fri, May 17, 2013 at 1:00 AM, loial wrote: I want to split a string so that I always return everything BEFORE the LAST underscore HELLO_.lst # should return HELLO HELLO_GOODBYE_.ls # should return HELLO_GOODBYE I have

Re: How to write fast into a file in python?

2013-05-17 Thread Dave Angel
On 05/17/2013 12:35 AM, lokeshkopp...@gmail.com wrote: On Friday, May 17, 2013 8:50:26 AM UTC+5:30, lokesh...@gmail.com wrote: I need to write numbers into a file upto 50mb and it should be fast can any one help me how to do that? i had written the following code.. value = 0 with open(file

Re: Please help with Threading

2013-05-18 Thread Dave Angel
On 05/18/2013 04:58 AM, Jurgens de Bruin wrote: This is my first script where I want to use the python threading module. I have a large dataset which is a list of dict this can be as much as 200 dictionaries in the list. The final goal is a histogram for each dict 16 histograms on a page ( 4x

Re: How to write fast into a file in python?

2013-05-18 Thread Dave Angel
On 05/18/2013 01:00 PM, Carlos Nepomuceno wrote: Python really writes '\n\r' on Windows. Just check the files. That's backwards. '\r\n' on Windows, IF you omit the b in the mode when creating the file. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list

Re: Please help with Threading

2013-05-19 Thread Dave Angel
On 05/19/2013 05:46 PM, Dennis Lee Bieber wrote: On Sun, 19 May 2013 10:38:14 +1000, Chris Angelico declaimed the following in gmane.comp.python.general: On Sun, May 19, 2013 at 10:02 AM, Carlos Nepomuceno wrote: I didn't know Python threads aren't preemptive. Seems to be something really o

Re: Harmonic distortion of a input signal

2013-05-19 Thread Dave Angel
On 05/19/2013 07:36 PM, killybear...@gmail.com wrote: One more question. Function np.argmax returns max of non-complex numbers ? Because FFT array of my signal is complex. It'd be easier to track the thread if you actually replied to the message you're responding to, and also if you included

Re: Please help with Threading

2013-05-20 Thread Dave Angel
On 05/20/2013 03:55 AM, Fábio Santos wrote: My use case was a tight loop processing an image pixel by pixel, or crunching a CSV file. If it only uses local variables (and probably hold a lock before releasing the GIL) it should be safe, no? Are you making function calls, using system libraries

Re: How to run a python script twice randomly in a day?

2013-05-21 Thread Dave Angel
On 05/21/2013 06:32 AM, Cameron Simpson wrote: On 21May2013 17:56, Chris Angelico wrote: | On Tue, May 21, 2013 at 11:12 AM, Cameron Simpson wrote: | > - randrange() is like other python ranges: it does not include the end value. | > So your call picks a number from 0..58, not 0..59. | > S

Re: Diagnosing socket "Connection reset by peer"

2013-05-22 Thread Dave Angel
On 05/22/2013 04:46 AM, loial wrote: Is there any additional traceing I can do(either within my python code or on the network) to establish what is causing this error? Try using Wireshark. It can do a remarkable job of filtering, capturing, and analyzing packets. It can also rea

Re: help in obtaining binary equivalent of a decimal number in python

2013-05-23 Thread Dave Angel
On 05/23/2013 07:30 AM, lokeshkopp...@gmail.com wrote: i need to get 32 bit binary equivalent of a decimal and need to change the 0's to 1's and 1's to 0's For Example if the input is 2 Output should be: the 32bit equivalent of 2 : 0010 and the 1's compliment is

Re: Debugging parallel nose tests?

2013-05-23 Thread Dave Angel
On 05/23/2013 09:09 AM, Roy Smith wrote: nosetests --process-timeout=60 --processes=40 test_api.py Do you have a 40-processor system? And do you have enough RAM to run all of those processes? -- DaveA -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-23 Thread Dave Angel
On 05/23/2013 11:26 AM, Carlos Nepomuceno wrote: Date: Thu, 23 May 2013 06:44:05 -0700 Subject: Re: PEP 378: Format Specifier for Thousands Separator From: prueba...@latinmail.com To: python-list@python.org [...] You left out the part where a and f are

Re: help how to sort a list in order of 'n' in python without using inbuilt functions??

2013-05-24 Thread Dave Angel
On 05/24/2013 04:04 AM, lokeshkopp...@gmail.com wrote: i need to write a code which can sort the list in order of 'n' without use builtin functions can anyone help me how to do? You could sort, but you couldn't print out the results, so what's the point? In Python 3.3 at least, print() is a

Re: suppress newlines in my script

2013-05-24 Thread Dave Angel
On 05/24/2013 09:59 AM, sloan...@gmail.com wrote: http://wiki.python.org/moin/GoogleGroupsPython > print PE2.format(count) Thanks for the tip about the CSV module. I did not know about that. So why aren't you using it? There's not much point in solving "the newlines pro

Re: Read txt file, add to iptables not working on new host

2013-05-24 Thread Dave Angel
On 05/24/2013 12:32 PM, JackM wrote: So Chris, does this version look better? Changed to inFile to with. #!/usr/bin/python import os import time # Input, Output, and TimeStamp logFile = open('/var/www/html/statistics/logs/banList.log','w') stamp = time.asctime(time.localtime()) # Daily Flush

Re: Total Beginner - Extracting Data from a Database Online (Screenshot)

2013-05-24 Thread Dave Angel
On 05/24/2013 01:32 PM, logan.c.gra...@gmail.com wrote: Hey guys, I'm learning Python Welcome. and I'm experimenting with different projects -- I like learning by doing. I'm wondering if you can help me here: na What this is is a publicly-accessible webpage No, it's just a jpeg file, an

Re: Total Beginner - Extracting Data from a Database Online (Screenshot)

2013-05-24 Thread Dave Angel
On 05/24/2013 07:36 PM, Carlos Nepomuceno wrote: page = urllib2.urlopen("http://example.com/page.html";).read().strip() #to create the tables list tables=[[re.findall('(.*?)',r,re.S) for r in re.findall('(.*?)',t,re.S)] for t in re.findall('(.*?)',page,re.S)] Pretty simple. Good luck!

Re: help how to sort a list in order of 'n' in python without using inbuilt functions??

2013-05-25 Thread Dave Angel
On 05/25/2013 10:03 AM, Roy Smith wrote: In article <74e33270-a79a-4878-a400-8a6cda663...@googlegroups.com>, lokeshkopp...@gmail.com wrote: ya steven i had done the similar logic but thats not satisfying my professor he had given the following constrains 1. No in-built functions should be u

Re: Reading *.json from URL - json.loads() versus urllib.urlopen.readlines()

2013-05-27 Thread Dave Angel
On 05/27/2013 04:47 PM, Bryan Britten wrote: Hey, everyone! I'm very new to Python and have only been using it for a couple of days, but have some experience in programming (albeit mostly statistical programming in SAS or R) so I'm hoping someone can answer this question in a technical way, b

Re: How to get an integer from a sequence of bytes

2013-05-27 Thread Dave Angel
On 05/27/2013 08:31 PM, Steven D'Aprano wrote: On Mon, 27 May 2013 11:30:18 -0400, Ned Batchelder wrote: On 5/27/2013 10:45 AM, Mok-Kong Shen wrote: From an int one can use to_bytes to get its individual bytes, but how can one reconstruct the int from the sequence of bytes? The next thing

Re: Problems with python and pyQT

2013-05-28 Thread Dave Angel
On 05/28/2013 05:41 AM, silusilus...@gmail.com wrote: Thanks for your reply: very useful!! I have another question: with hex command i display (for example) 0x1 is it possible to display 0x01? hex() is a function, not a command. And it only takes the one parameter, the int to be converted.

Re: Python for IPSA (Power flow analysis)

2013-05-28 Thread Dave Angel
On 05/28/2013 06:00 AM, Debbie wrote: Hi there, I am new to Python, Welcome. Could you tell us a little about yourself, such as whether you've experience in a few other languages, or if Python is your first programming experience? Also, what version of Python (presumably 2.7 or 2.6) and wh

Re: Python #ifdef

2013-05-28 Thread Dave Angel
On 05/28/2013 03:46 PM, Carlos Nepomuceno wrote: Are there Python 'preprocessor directives'? Python doesn't define a preprocessor, and CPYthon doesn't implement one. Nothing to stop you from doing so, however. I'd like to have something like '#ifdef' to mix code from Python 2 and 3 in a si

Re: Fatal Python error

2013-05-29 Thread Dave Angel
On 05/29/2013 07:48 AM, Joshua Landau wrote: Hello all, again. Instead of revising like I'm meant to be, I've been delving into a bit of Python and I've come up with this code: To start with, please post in text mode. By using html, you've completely messed up any indentation you presumably

Re: Fatal Python error

2013-05-29 Thread Dave Angel
On 05/29/2013 08:45 AM, Oscar Benjamin wrote: On 29 May 2013 12:48, Joshua Landau wrote: Hello all, again. Instead of revising like I'm meant to be, I've been delving into a bit of Python and I've come up with this code: Here's a simpler example that gives similar results: $ py -3.3 Python 3

Re: Short-circuit Logic

2013-05-29 Thread Dave Angel
On 05/29/2013 12:50 PM, Ian Kelly wrote: On Wed, May 29, 2013 at 8:33 AM, rusi wrote: 0.0 == 0.0 implies 5.4 == 5.4 is not a true statement is what (I think) Steven is saying. 0 (or if you prefer 0.0) is special and is treated specially. It has nothing to do with 0 being special. A floating

Re: User Input

2013-05-30 Thread Dave Angel
On 05/30/2013 08:37 AM, Eternaltheft wrote: sorry about that, i got confused xD. yeah it works good now. what i meant to say was can i return a function that i made, if the user inputs nothing? There wouldn't be anything to stop you. However, if you have multiple returns from the same funct

Re: Can anyone please help me in understanding the following python code

2013-05-30 Thread Dave Angel
On 05/30/2013 08:42 AM, bhk...@gmail.com wrote: http://wiki.python.org/moin/GoogleGroupsPython > In the above output, the control goes to "HERE AFTER SPLIT" after the "Merging" statement which is of-course the last statement in the function.On what condition this is happening. Ideally

Re: User Input

2013-05-30 Thread Dave Angel
On 05/30/2013 09:10 AM, Eternaltheft wrote: yeah i found out why it wasn't defined before because i tried to put it into a function. That's not a sentence, and it doesn't make sense in any permutation I can do on it. this is my drawBoard function: import turtle as Turtle Turtle.title("Ch

Re: Create a file in /etc/ as a non-root user

2013-05-31 Thread Dave Angel
On 05/31/2013 05:27 AM, Luca Cerone wrote: fd = open('/etc/file','w') fd.write('jpdas') fd.close() Hi Bibhu, that is not a Python problem, but a permission one. You should configure the permissions so that you have write access to the folder. However unless you know what you are doing it is

Re: Getting Error can't find '__main__' module in 'X'

2013-06-02 Thread Dave Angel
On 06/02/2013 07:04 AM, meakaakka wrote: Hey I am newbie in python.I have installed python 2.7.5 correctly.It is working fine but I am having some issues.I have set windows Enviroment variables. Please be a lot more specific. Do you have any particular environment variables you suspect, and

Re: PyWart: The problem with "print"

2013-06-03 Thread Dave Angel
On 06/03/2013 04:49 AM, Mark Lawrence wrote: On 03/06/2013 04:10, Dan Sommers wrote: On Sun, 02 Jun 2013 20:16:21 -0400, Jason Swails wrote: ... If you don't believe me, you've never hit a bug that 'magically' disappears when you add a debugging print statement ;-). Ah, yes. The Heisenbug.

Re: How to get an integer from a sequence of bytes

2013-06-03 Thread Dave Angel
On 06/03/2013 10:31 AM, Grant Edwards wrote: On 2013-06-03, Dennis Lee Bieber wrote: On Sun, 02 Jun 2013 21:25:45 +0200, Mok-Kong Shen declaimed the following in gmane.comp.python.general: b'7' is the byte with the character 7 in a certain code, so that's ok. In other PLs one assigns an int

Re: lstrip problem - beginner question

2013-06-04 Thread Dave Angel
On 06/04/2013 12:01 PM, Mark Lawrence wrote: On 04/06/2013 16:49, mstagliamonte wrote: [strip the double line spaced nonsense] Can you please check your email settings. It's bad enough being plagued with double line spaced mail from google, having it come from yahoo is just adding insult to in

Re: How to store a variable when a script is executing for next time execution?

2013-06-06 Thread Dave Angel
On 06/06/2013 06:50 AM, Avnesh Shakya wrote: hi, I am running a python script and it will create a file name like filename0.0.0 and If I run it again then new file will create one more like filename0.0.1.. my code is- i = 0 Redundant initialization of i. for i in range(1000):

Re: trigger at TDM/2 only

2013-06-06 Thread Dave Angel
On 06/06/2013 08:03 PM, cerr wrote: Hi, I have a process that I can trigger only at a certain time. Assume I have a TDM period of 10min, that means, I can only fire my trigger at the 5th minute of every 10min cycle i.e. at XX:05, XX:15, XX:25... For hat I came up with following algorithm whic

Re: Trying to work with data from a query using Python.

2013-06-07 Thread Dave Angel
On 06/07/2013 01:44 PM, ethereal_r...@hotmail.com wrote: rows = cur.fetchall() for row in rows: print row Now assume that fetchall would print the following: I doubt if fetchall() prints anything. presumably it returns something, extracted from the db. LOEL

Re: Questions on "import" and "datetime"

2013-06-10 Thread Dave Angel
On 06/10/2013 01:01 PM, Zachary Ware wrote: On Mon, Jun 10, 2013 at 10:37 AM, Yunfei Dai wrote: Hi all, Hi Yunfei, I have some questions on "import": 1."from datetime import datetime" works well. But I am confused why "import datetime.datetime" leads to importerror. "from xlrd import ope

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Dave Angel
On 06/10/2013 01:42 PM, Rui Maciel wrote: Peter Otten wrote: Have you read the code in the interpreter session I posted? If you do not agree that the demonstrated behaviour is puzzling I'll have to drop my claim... I don't see how it should be puzzling. You've deleted the attribute, so it c

Re: Popen and reading stdout in windows

2013-06-10 Thread Dave Angel
On 06/10/2013 02:37 PM, Joseph L. Casale wrote: I have a use where writing an interim file is not convenient and I was hoping to iterate through maybe 100k lines of output by a process as its generated or roughly anyways. Seems to be a common question on ST, and more easily solved in Linux. Anyo

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Dave Angel
On 06/10/2013 06:54 PM, Chris Angelico wrote: On Tue, Jun 11, 2013 at 8:39 AM, Grant Edwards wrote: On 2013-06-10, Terry Jan Reedy wrote: Another principle similar to 'Don't add extraneous code' is 'Don't rebind builtins'. OK, we've all done it by accident (especially when starting out), b

Re: Do you consider Python a 4GL? Why (not)?

2013-06-11 Thread Dave Angel
On 06/11/2013 03:48 PM, Laurent Pointal wrote: Dennis Lee Bieber wrote: On Tue, 4 Jun 2013 18:17:33 -0700, Dan Stromberg declaimed the following in gmane.comp.python.general: The C compiler suites used this ability to read the error log from a compile, and move to the line/column in

Re: Simple algorithm question - how to reorder a sequence economically

2013-06-12 Thread Dave Angel
On 05/25/2013 09:49 PM, Roy Smith wrote: In article <15a1bb3a-514c-454e-a966-243c84123...@googlegroups.com>, John Ladasky wrote: Because someone's got to say it... "The generation of random numbers is too important to be left to chance." ‹ Robert R. Coveyou Absolutely. I know just enough

Re: Survey of Python-in-browser technologies

2013-06-12 Thread Dave Angel
On 05/24/2013 08:38 PM, Carlos Nepomuceno wrote: Date: Fri, 24 May 2013 17:11:18 -0700 Subject: Re: Survey of Python-in-browser technologies From: drsali...@gmail.com To: carlosnepomuc...@outlook.com CC: python-list@python.org Security is an important topic...

Re: User Input

2013-06-12 Thread Dave Angel
On 05/30/2013 10:03 AM, Eternaltheft wrote: do you think ti would be better if i call drawBoard? Better is meaningless without context. Are you being charged per keystroke? -- DaveA -- http://mail.python.org/mailman/listinfo/python-list

Re: A few questiosn about encoding

2013-06-12 Thread Dave Angel
On 06/12/2013 05:24 AM, Steven D'Aprano wrote: On Wed, 12 Jun 2013 09:09:05 +, Νικόλαος Κούρας wrote: Isn't 14 bits way to many to store a character ? No. There are 1114111 possible characters in Unicode. (And in Japan, they sometimes use TRON instead of Unicode, which has even more.) I

Re: Performance of list.index - how to speed up a silly algorithm?

2013-06-13 Thread Dave Angel
On 06/13/2013 10:55 AM, Onyxx wrote: I would convert your list to a pandas dataframe. You're leaving a message on a public forum without any context in the message, using a title that was apparently last used in 2010. Are you really trying to reply to a message from over 3 years ago??? --

<    1   2   3   4   5   6   7   8   9   10   >