15,175 Topics

Member Avatar for
Member Avatar for eyewirejets

Where should your definitions of your functions be in your code? Should they be down below or above? What is the best way? Beginner Question - Thanks for your support.

Member Avatar for Stefano Mtangoo
0
82
Member Avatar for wheatontrue

Dear all, I am trying to parse a lot of text. for small amounts of text, the WHILE loop I use to find all spaces in the text works well: markerlist=[] counter=0 while len(markerlist)<text.count(marker): [INDENT]markerlist.append(text.find(marker,counter) counter=text.find(marker,counter)+1[/INDENT] This iterative process is very, very slow when working with a few megabites of …

Member Avatar for wheatontrue
0
138
Member Avatar for leegeorg07

i have made a simple music player that will randomly choose a song from the list (music) how can i expand this to a whole directory of music without having to make a list with them all in heres the code: [code] import webbrowser, random music = [#music was here] …

Member Avatar for leegeorg07
0
696
Member Avatar for starzstar

Has any one tried using pyDAV a webDAV library for Python, I am getting a followind error whilw trying to list the contents of a collection 2009-02-05 17:38:58,092: DEBUG: REQUEST Send OPTIONS for /uc910015/home/ 2009-02-05 17:38:58,092: DEBUG: REQUEST Body: None 2009-02-05 17:38:58,092: DEBUG: REQUEST Header: ('AUTHORIZATION', 'Basic U3Rvc nZUVncjAwMTpJSUtD') 2009-02-05 …

Member Avatar for starzstar
0
112
Member Avatar for abczxy124
Member Avatar for Stefano Mtangoo
0
139
Member Avatar for breatheasier

Hi, I'm trying to create a 2-Dimensional box in vpython and fill it with circles placed in random positions but the circles cannot overlap. This is how far I have got, but I can't work out how to make the positions not overlap. I'm sure most of what I've done …

Member Avatar for Stefano Mtangoo
0
95
Member Avatar for leegeorg07

hi again im doing the spell checker program in the projects for the beginner thing and i have this code: [ICODE] dict = open("DictionaryE.txt", "r").readlines() test = "Hello my nmae is george" correct = [] for line in test: if line in dict: correct.append(line) print line print correct [/ICODE] but …

Member Avatar for leegeorg07
0
385
Member Avatar for Stefano Mtangoo

Whenever I have lists or tuple lists I have something like u' (check sample result). What does this do? [CODE=python](u'03/02/2009', u'Billing for gas', 100.0, 210.0, 200.0) (u'15/04/2009', u'paying fees for OUT', 0.0, 10405.0, 0.0) (u'03/02/2009', u'Billing for gas', 100.0, 210.0, 200.0)[/CODE]

Member Avatar for Stefano Mtangoo
0
129
Member Avatar for jaysonperry22

[code] def main (): display_message () # get user's first name first_name = raw_input('Please enter your first name: ') print 'Hello', first_name # input total sales total_sales = raw_input('Please enter your total sales: ') # input total hours total_hours = raw_input('Please enter your total hours worked: ') # input total …

Member Avatar for vegaseat
0
122
Member Avatar for iuessele

Can anyone tell me how to write a program that displays all of the cards from a deck of playing cards? i set up two tuples, one with the ranks and the other with the suits. I cant figure out how to make the Ace of spades - King of …

Member Avatar for Stefano Mtangoo
0
105
Member Avatar for Stefano Mtangoo

I'm trying to grasp SQLite to do some stuffs I want it to do, but it is sometimes too hash to me :) So what i'm I wrong with this code?? [CODE=python] #!/usr/bin/ # SQLite command to be used with the applications import sqlite3 as sqlite import os class SqliteCommands: …

Member Avatar for Stefano Mtangoo
0
125
Member Avatar for kiddo39

I'm trying to auto send a form submission to a website but it isn't working. I've done this before and it worked but for some reason, using the same basic code, it doesn't seem to submit it. I'm using urllib & urllib2 to open the page and re to parse …

0
95
Member Avatar for vjp08

Hi, i have opened a file from a python sript using built in function 'file'. after reading data from that file, i closed the file descriptor and tried to delete the file but it gives an error that file is being used by another process whereas none of the process …

Member Avatar for scru
0
161
Member Avatar for drew7py

I have this code that manipulates many list (which are a mix of numbers and words) and I need it to print to a text file in rows without brackets. here is the code: ingroup = open("C:\Python25\Drew\subgroup.txt", 'r') outgroup = file ("dID.txt", 'w') ct = 1 rcw = ingroup.readlines() cID=0 …

Member Avatar for drew7py
0
16K
Member Avatar for juzzy

im thinking about how i could manipulate gui windows, so that if I were to have, say two separate programs running in two separate windows and i were to drag one the other would follow. does anyone know how i would begin to go about doing this? I'm actually using …

Member Avatar for Stefano Mtangoo
0
134
Member Avatar for leegeorg07
Member Avatar for leegeorg07
0
108
Member Avatar for kiddo39

I know python has math functions like 5+6 and 5*6 and 5/6 etc...but I have something like this: x=575124357 and need to add them all together: 5+7+5+1+2+4+3+5+8=40

Member Avatar for kiddo39
0
65
Member Avatar for scru

This function is supposed to take an integer that contains an rgb value, extract the value of each channel, and then return that calculated luminance of the pixel. As it stands, the performance of this function is not fast enough. Looking at it, I can't think of anything else that …

Member Avatar for vegaseat
0
151
Member Avatar for kiddo39

I have a randomly generated list of which contains letters, symbols, and numbers and need to separate it into 2 lists -one of numbers and one of the remaining chars. Then I need to separate the numbers into 2 lists-one of composite numbers (4,6,8,9) and one a list of prime …

Member Avatar for kiddo39
0
125
Member Avatar for mruane

I am hoping to create a pixel based rpg game with the story depth of the elder scrolls series, with graphics similar to PixelMan 3 by pymike, (pygame.org/project/712/). If anyone is interested in helping, let me know! I am a basic level python programmer, so am using this project as …

Member Avatar for mruane
0
86
Member Avatar for kiddo39

Hi.....I have a long string of letters and symbols and I need to increment their ascii value by 1. How can I do that? Here's an example of the string: s="p@ugdyhtapbcedoamguh?a#vdaxdv$zdoxw?pu$exrbzt evk#n$xjlgpmece??$$@@yyiw##rmn$nmrblruv ?azxdsoh#$@nndkkt?k@ihatywtbazgbq#ykshx" so like # becomes $, etc

Member Avatar for kiddo39
0
68
Member Avatar for vjp08

Hi, i want to run a python script from another python sript as a new process. i have tried with spawn functions of os module but it didnt work. i guess these functions work on only Linux. how to create a new process on windows platform..

Member Avatar for vjp08
0
172
Member Avatar for l_w

Could someone please point me to a good example of user forms and how to get data out of them for Python 2.3?

Member Avatar for l_w
0
33
Member Avatar for mruane

I am trying to use binascii to convert this: [code=python] town1 = """ ++++++++++++++++++++++++++++++++++++ +-------------------------------------------------------------+ +----------H-----------H----------H---------H--------------+ +----------&---------------&---------------------------------+ +------------------------------------------------------------>+ +----------------@-------------------------------------------+ ++++++++++++++++++++++++++++++++++++ """ [/code] into the type of graphics used in PyMike's PixelMan 3, found at pygame.org. I looked at the document on python.org telling about binascii and a little bit about …

0
127
Member Avatar for mruane

I would like to use pickle() to save the stats, progress, and location of a player in my text adventure. I know that pickle() write an object to a text file, and that file can be later recalled to load the information. My curiosity is, would I be able to …

Member Avatar for mruane
0
294
Member Avatar for lllllIllIlllI

Hi For one of my programs i want to be able to graph the performance of things in a graph. The thing is that this graph constantly made a little bit longer with every second that passes. So i was wondering what paintDC to use. And how to use it. …

Member Avatar for lllllIllIlllI
0
79
Member Avatar for Jigs_ff

Hi All, I am new to programming world, i wanted to make a script which will create folder when counting of files breaks. for Example- 1) I have 1000 no of jpg files in a single folder.(but ) 2) but these files has a number break in between. (like it …

Member Avatar for jlm699
0
125
Member Avatar for l_w

Python 2.3.7 has the following functions as number converters: float(num), int(num), long(num). But what happened to double(num)? If my number is a=3.33333 and do round(_,2), the output I get is 3.3300000000000001. I was expecting to see 3.33. What’s happening to here? Thank you. liliya

Member Avatar for l_w
0
139
Member Avatar for foker500

This is probably a newbie question but I've figured out how to connect and query a microsoft access database via ado, but I can't figure out how to export the tables......need to export them to dbf???? Any help would be greatly appreciated.

Member Avatar for jice
0
156
Member Avatar for harrykokil

hi guys i have a small problem. the cars in my program collide against each other. it works when i don't have any class car. but now there's some confusion with the speed of the car. ive worked for hours on this but no solution found. i hope u guys …

Member Avatar for Stefano Mtangoo
0
95

The End.