4,305 Posted Topics
Re: I would use the Python third party module matplot (pylab), free from: http://matplotlib.org/contents.html For a nice example see: http://matplotlib.org/examples/mplot3d/bars3d_demo.html | |
Re: The last song count on my IPod was 126. Mostly classic rock and classic jazz. | |
A simple code example to calculate the monthly payment on a mortgage loan. Takes a look at Python's newer print and format functions. | |
Re: What have you come up with so far? | |
Re: On the Python forum we have listed a whole bunch of projects. Look through them, some will easily apply to C ... http://www.daniweb.com/software-development/python/threads/32007/projects-for-the-beginner | |
Just a different way to extract desired data from an xml code string. | |
Re: A model allows you to customize a widget or make it more generic. See ... http://www.daniweb.com/software-development/python/code/447834/applying-pysides-qabstracttablemodel | |
Re: Since you are using a loop with a defined limit, a for loop would be better. | |
Re: C header files often include other header files, which include other header files in turn. By chance you might end up with <stdlib.h> included. I would not rely on it! | |
Re: We need some code. | |
Re: A little different ... names = ['Google', 'Apple', 'Microsoft'] print(["%d %s" % pair for pair in enumerate(names)]) ''' ['0 Google', '1 Apple', '2 Microsoft'] ''' | |
Re: See if this works ... subprocess.call(["script", "scripttest.txt]).wait() | |
Re: Might as well take advantage of module random ... def make_list2(n): return random.sample(range(1000), n) print(make_list2(10)) In Python2 use xrange() for large numbers. In Python3 range() is a generator. | |
A short code to show you how you can download and display an image from the internet on Python's Tkinter GUI toolkit. | |
Re: You could simplify this a little with ... lines1 = open("Text1.txt").readlines() lines2 = open("Text2.txt").readlines() # set up module difflib diff_instance = difflib.Differ() diff_list = list(diff_instance.compare(lines1, lines2)) | |
Re: # Python2 uses raw_input() for strings and input() for numbers # Python3 uses input() for strings # ---------------------------------------------- # add these few lines near the start of you code import sys # make string input work with Python2 or Python3 if sys.version_info[0] < 3: input = raw_input # ---------------------------------------------- programStart … | |
Re: http://stackoverflow.com/questions/14792858/how-to-create-a-rectangle | |
Just a simple Jython code to test drawing on the canvas. | |
Re: Reading file "Encontract.txt" does not give you a list. Use something like this ... with open("Encontract.txt") as fin: contrwords_raw = fin.read() # make a list, also removes new line char contrwords = [word for word in contrwords_raw.split()] | |
| |
Re: As you execute cx_freeze it will actually show what it includes by default. Usually re is in that list. Also look at snippsat's include_files option. | |
Re: The game was great, the entertainment was great, and the commercials had some good moments (Farmers). I had fun and a few beers, and I am still happy. | |
A small test program exploring the PySide/PyQT Label widget. With HTML code you can do some nice formatting of the label's text. | |
The PySide/PyQT QValidator restricts the type of input a widget like QLineEdit can accept. Here is a simple test. | |
Re: Not on the list ... Sin City Brewing turns out a great tasting local micro-brew. http://www.sincitybeer.com/lasvegasmicrobrewery.html | |
Another exercise in applied geometry. This time we use the Tkinter GUI canvas and its create_line() function to draw a triangle, or a series of connected triangles to create something that looks like fancy art work. You might be able to impress grandmama with that one! | |
Re: Do you have PyQT/PySide installed on IronPython? | |
Re: Pygame uses the SDL library (written in C++). Looks like one of your SDL files is corrupt or missing. On my Windows box the image handling file is called **SDL_image.dll** There should be a Unix/Linux equivalent. | |
A function to take a text and extract the string between two given substrings. Allows you to find the nth occurence. Also safeguards against dead ends. | |
Re: Here are a few things that need to be improved in your code ... 1) don't import inside the loop or you keep on reimporting 2) don't define a function inside the loop or you keep on redefining 3) all your if statement need to be something like this **if … | |
Re: For those who want to minimize typing ... [code]# this saves you from having to add quotes around any strings/characters (keys only) dic1 = dict(a=1, b=2, c=3, d=4) print dic1 # {'a': 1, 'c': 3, 'b': 2, 'd': 4} [/code] | |
Re: Take a look at the C# Scripting Engine project, it's open source. [URL]http://www.members.optusnet.com.au/~olegshilo/index.html[/URL] | |
Re: Interesting project. Have you discovered anything yet? | |
Re: Looks like the interpreter evaluates **0 == not** | |
Re: numpy-MKL-1.6.2.win32-py3.3.exe can be found at the Gohlke site | |
Re: Data applied to LSH can consist of images, sounds, gene expressions and the like. You generally use LSH to detect similarities. | |
Re: Looks like **in_=instructions,** is not a grid option, so leave it out. | |
Re: Looks like the Django gurus are not hiding on DaniWeb. If you find out where they are hiding, please let us know. | |
Re: Oh yes, J language is powerful but rather cryptic, so I want to salute pyTony for coming up with a solution! I meant to give you this hint ... NB. exploring J lists NB. using J language free from www.jsoftware.com NB. see http://www.jsoftware.com/help/learning/contents.htm NB. create a list of integers 0 … | |
Re: You can aslo use the WYSIWYG approach to format your output ... # Purpose: Tax input amount # #----------------------------------------------------------------------- # VARIABLE DEFINITIONS #----------------------------------------------------------------------- # CONSTANT DEFINITIONS #----------------------------------------------------------------------- # FUNCTION DEFINITIONS #----------------------------------------------------------------------- # PROGRAM'S MAIN LOGIC salesAmount = float (raw_input("Enter the sales amount: ")) salesTax = salesAmount*0.08 total = salesAmount + … | |
Re: Viruses are well supported by their authors, are frequently updated, and tend to become more sophisticated as they mature. So there! Windows is not a virus. | |
You may want to call Python's list the answer to other computer languages' arrays. Here we take a look at the things you can do with lists, create an empty list, list the attributes and methods, load, append, count, insert, join, pop, remove, remove duplicate items, reverse, search, sort, establish … | |
Re: If you want to call the appropriate function, do this ... code = prodcust_code[:2] if code == "AB": function_AB() elif code == "CC": function_CC() elif code == "EF": function_EF() elif code == "US": function_US() else: print("No function found for {}".format(code)) | |
Re: You can use the more exact Newton's Method Python version from: http://www.daniweb.com/software-development/python/code/444930/newtons-method-example-python Here is the example for a squareroot solution ... ''' Newton_method2.py find value for x in f(x) = 0 using Newton's method ''' def derivative(f): def compute(x, dx): return (f(x+dx) - f(x))/dx return compute def newtons_method(f, x, dx=0.000001, … | |
This PySide (PyQT) code sample shows you how to apply a StyleSheet to a GroupBox containing a number of RadioButtons. | |
A little fun drawing with the Python module turtle. Well commented to help the beginner. | |
Re: For a dictionary approach see: http://www.daniweb.com/software-development/python/code/446042/a-matrix-dictionary-python | |
Re: Another look at closure ... ''' closure102.py A nested function has access to the environment in which it was defined. This definition occurs during the execution of the outer function. In a closure you return the reference to the inner function that remembers the state of the outer function, even … | |
Re: **if event.type == K_BACKSPACE:** does not work properly, replace with **if chr(event.key) == '\x08':** Also blank out the old text before you rewrite it. |
The End.