15,181 Topics
| |
| i have this code: [ICODE]import random choices = ['closet', 'lampshade', 'fridge'] print "i have hidden 10,000,000 pounds in one of these places:", choices choice = raw_input("Where do you want to search? ('closet', 'lampshade', 'fridge')") random_c = random.choice(choices) while choice != random_c: choices.del(random_c) for word in choices: if choice == word: … |
Hi I am using optparser to design a command line interface.How do I read multiple arguments. For eg if I want to create a folder, I will take the arguments path and folder name something lilke the following main.py --createFolder Tesfolder --path C://Test/Test/... How to read these arguments? I can … | |
#After user inputs the year they were born I want to break it down using fadic addition like below# birth_year = int(raw_input('Please enter the year you were born')) #User inputs 1953 birth_year = 1953 #What I want is to do this using Fadic addition: birth_number1 = 1 + 9 + … | |
[URL="http://www.megaupload.com/?d=GZJD9V51"]http://www.megaupload.com/?d=GZJD9V51[/URL] Above is the program spec. and below is what I did so far. [code=python]numStr = raw_input("'p' to be prompted for the secret number or 'g' to have it generated: ") p = numStr print print true = p while true: secret = raw_input("Enter the 'secret' number (five digits, no … | |
Maybe I have this all completely wrong because I don't know what I'm doing, but I'm trying to work with win32 programming and I want to get the position of all the items on the desktop. I've found the handle for the desktop and I've found the LVM constants in … | |
I am attempting to write a JSONP application and think that it is not working because the JSON my code is returning has surrounding quotation marks. For example when I call the webapp using [url]http://rest-client.googlecode.com/[/url] it returns the following "callbackfunctionname({'Last': 'Doe', 'First': 'John'})" Comparing this to a public url I … | |
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. | |
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 … | |
| 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] … |
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 … | |
i need to design a python program that will calculate these two things. can someone help me out here? | |
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 … | |
| 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 … |
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] | |
[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 … | |
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 … | |
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: … | |
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 … | |
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 … | |
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 … | |
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 … | |
| |
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 | |
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 … | |
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 … | |
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 … | |
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 | |
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.. | |
Could someone please point me to a good example of user forms and how to get data out of them for Python 2.3? | |
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 … |
The End.