15,175 Topics

Member Avatar for
Member Avatar for StratmanPereida

I need to make this into a multi-dimensional array. I know I need to change presArray = Table1Builder(60, "STR") to presArray = Table1Builder(60,3, "STR") I am not sure how to load it. Do I need three load statements? Help Please! [code] # Import string to use split function. import string …

Member Avatar for StratmanPereida
0
180
Member Avatar for Krysis

Hey all, I must say that I've had a lot of success with my questions here at DaniWeb, which is why (in my time of need), I'm back and seeking the help of the wise! Hopefully, someone can help me with this and has some basic knowledge of Pygame? Heh, …

Member Avatar for Krysis
0
459
Member Avatar for jozz3

I am trying to define a function that draws a triangle of a given size using the turn method. I've never used turtle graphics before and am not sure how to go about this. Thank you

Member Avatar for vegaseat
0
808
Member Avatar for pankajpriyam

Hi, I am using Python 2.3.4 in Linux environment. I have some sql files, I execute sql files in a loop. I want to generate seprate log files for every sql files in loop. How can I do this. regards pankaj

Member Avatar for jice
0
98
Member Avatar for Alq Veers

Ive been working on this for a while, and still am quite stuck. I've got the menu code done and it causes no problems, but as for organising the screen for the remaining two sections I am still having trouble. Im using the .grid() setting, and am thinking if I …

0
63
Member Avatar for z 4

This def has too many IF, i don't know how to optimize this code for more simplier and professional. Please take a look. [CODE]def cfg_wlan(self, wlan_cfg): """ Configure a new wlan for Zone Director. Input: a dictionary, supplied in DUT.py Output: none """ if wlan_cfg['auth'] == "PSK": auth = "open" …

Member Avatar for Gribouillis
0
109
Member Avatar for TrustyTony

Here tool functions, which came up during discussions earlier. Expanded slightly, added elimination of traceback prints by try..except. Added dd.mm.yy routine as that is format in my home country Finland. Optimized docstring beginnings to be informative in editor tooltip (at least IDLE shows, but code must be run or imported …

Member Avatar for TrustyTony
1
960
Member Avatar for kadvar

Hi, I basically have a dictionary with a few key value pairs in it. [CODE] mydict = {} mydict['key1'] = 2000 mydict['key2'] = 3000 mydict['key3'] = 6000[/CODE] I have read that you can check if a particular key is present in a dict with the '[B]in[/B]' statement like: [CODE]if 'key1' …

Member Avatar for kadvar
0
151
Member Avatar for biomed

I have a tab delimeted file that I want to convert into a mysql table. there are 25 tab delimeted fields in the text file. I can get the values in when I construct the SQL statement word by word and get each value individually stated in the VALUES part …

Member Avatar for biomed
0
83
Member Avatar for LucyX

Hi Guys, im fairly knew to this world of programming, but it interests me greatly. In order to better my skills, ive decided to tackle a few personal projects in my spare time . . . . Ive been advised to give the Hilbert Curve a bash. However getting started …

Member Avatar for ultimatebuster
0
264
Member Avatar for G_S

Hi, I have another question: ¿is there a method that allows me to capitalize the first letter of EVERY WORD in a given string? I know that something like: [CODE=python]a = "hello world" print(a.capitalize())[/CODE] would print "Hello world" but I need it to print Hello World. It's for a program …

Member Avatar for TrustyTony
0
886
Member Avatar for ihatehippies

Does anyone know of a way to change a property from read-only to writable on the fly without changing the source?[CODE=python] >>> p = property(lambda self: self.__p) >>> p.fset = lambda self: self.__p Traceback (most recent call last): File "<pyshell#19>", line 1, in <module> p.fset = lambda self: self.__p TypeError: …

Member Avatar for jcao219
0
108
Member Avatar for toll_booth

OK, in reference to my last thread, I finally got PIL installed and set up. I can even successfully import it (from PIL import Image). All that remains to be done is for me to successfully get an image into my GUIs, and I'll be good to go. Can someone …

Member Avatar for vegaseat
0
175
Member Avatar for xSDMx

Here's the code I put together to create concentric circles using Python: [CODE]def concentric(myTurtle,number,spacing): for radius in range(number): x = myTurtle.xcor() y = myTurtle.ycor() myTurtle.up() myTurtle.goto(x,spacing) myTurtle.down() drawCircle(myTurtle,radius*y+spacing) myTurtle.up() myTurtle.goto(x,spacing) myTurtle.down()[/CODE] It, however, has a critical flaw. I need the code to be able to goto any given set of …

Member Avatar for xSDMx
0
750
Member Avatar for rasizzle

Hey all, Here is some code for reading Excel spreadsheets (2003 and before) with PyExcelerator. My main problem is that if I leave a cell blank, it gives me an error. I want to be able to have blank cells on my spreadsheet without any problems. Does anyone have any …

Member Avatar for Gribouillis
0
501
Member Avatar for peppermints

The commented part is where I believe the issue is at. [CODE]from livewires import games, color import random games.init(screen_width = 640, screen_height = 480, fps = 50) class Paddle(games.Sprite): image = games.load_image("paddle.bmp") def __init__(self): super(Paddle, self).__init__(image = Paddle.image, x = 10, y = games.mouse.y, bottom = games.screen.height) def update(self): self.y …

Member Avatar for TrustyTony
0
614
Member Avatar for theweirdone

Hi, I'm trying to take a date, add a day to it, and then convert it to a string. The date's format starts out like: '10/1/2009', and should end like: '2009-10-1'. I can do that part, but then I can't convert it to a date format and add a day. …

Member Avatar for TrustyTony
0
261
Member Avatar for toll_booth

OK guys, in regards to my [url=http://www.daniweb.com/forums/thread273163.html]last thread[/url], I've decided to give PIL a shot. Trouble is, the setup instructions are as clear as mud. I've got the files downloaded and extracted, but that's as far as I've been able to get. Can someone, IN PLAIN ENGLISH, walk me through …

Member Avatar for toll_booth
0
202
Member Avatar for dpswt

Hello everyone. My question is how can we save the items on listctrl so everytime someone opens the application, the items previously added are there. I'm trying to accomplish this with wx.Config, but I can't seem to find a good way to read the config so it accomplishes what I …

Member Avatar for lllllIllIlllI
0
243
Member Avatar for cyon

Given s.ss or seconds accurate to the hundredth place, what is the most effective way to convert it to the string mm:ss.s? Here is my current attempt: [CODE]import time def convert(t): print time.strftime("%M:%S",time.gmtime(round(t,1)))+str((".%01d" % (((round(t,1))-int(round(t,1)))*10))) t = float(raw_input('Enter time in s.ss: ')) convert(t)[/CODE] However, the results don't seem quite right: …

Member Avatar for TrustyTony
0
531
Member Avatar for rasizzle

Hey guys. I just started using portable python and I have to say this module is great. It helped me bypass some problems transferring modules between win32 and win64 cpus. So my question is for all you portable python users is: do you have to install python for each new …

Member Avatar for rasizzle
0
179
Member Avatar for soUPERMan

hello, was wondering how to sort a list which has different data types according to the data type, Example if a list containing 'person' objects. a person object wil have a name, gender and age like so: person1 = person(name, gender, age) so if i have 5 objects in a …

Member Avatar for soUPERMan
0
83
Member Avatar for elmaami

Hello I want u to help me about how to encrypt file is sent between web client and web server. Thank u....

Member Avatar for jcao219
0
47
Member Avatar for theweirdone

Hi, I'm making something of an RSS reader-ish. I'm using the [URL="http://www.feedparser.org/"]Universal Feed Parser[/URL] to do this. The feed is just a list of TV shows, and the date they air. I'm successful at getting the feed, now what i'm trying to do is split it up into chunks that …

Member Avatar for theweirdone
0
125
Member Avatar for cyon

Is there a way to, instead of duplicating code, to either print the desired number of rows from a list (from user input) or print all items in the list? [CODE]print_list( input ): f = open('pickle.dat', "r") L = cPickle.load(f) f.close() for i in range( input=len(L) ): print 'L[i] = …

Member Avatar for TrustyTony
0
124
Member Avatar for lebron

I have something to share with you guys if you can help me out.. Here is an algorithm to print out a pyramid of numbers: [I][B]define totalRows to be how many rows define columnWidth to be how many characters in each column for currentRow in range 0 up to (but …

Member Avatar for TrustyTony
0
157
Member Avatar for lebron

'''check addition''' from random import randint def checkAddition( a, b ): ans = int(raw_input("What is %d + %d ? " % (a,b))) if ans == a + b: return True else: return False def main(): x = randint(1,100) y = randint(1,100) if checkAddition(x,y): print "Correct" else: print "Incorrect" main()[B] [I]This …

Member Avatar for Kruptein
0
99
Member Avatar for Kruptein

I was wondering if it was possible to use pygments with wxPython? I want to use it on the text_ctrl widget. If it is not possible on that widget but is possible on an other please tell me...

Member Avatar for Kruptein
0
187
Member Avatar for vegaseat

A little late for April 1, but here is the secret code ... [code]searchEngineNames = [] for c in range(ord('A'), ord('Z')+1): name = chr(c)+'ing' searchEngineNames.append(name) # pick #1 print(searchEngineNames[1]) [/code]

Member Avatar for TrustyTony
4
107
Member Avatar for ITgirl2010

i have been working on this code [code=syntax] '''Calculate the cost of fuel for a road trip''' def main(): distance = float(raw_input("Enter distance in kilometres: ")) litresPer100K = float(raw_input("Enter economy (ltr/100km): ")) pricePerLitre = float(raw_input("Enter fuel price per litre ($): ")) cost = distance / 100 * litresPer100K * pricePerLitre …

Member Avatar for ITgirl2010
0
115

The End.