15,185 Topics
| |
hello everbody, can someone please help me, how do i turn a list like a=[0,1,2,3,4] into 01234 i tried for i in range (len(a)) print a[i], but thats give me 0 1 2 3 4 thanks, fabio | |
Is it posible to delay the program for a certain time period. I know in blitz basic you could type "delay 5" and at that spot in to the program theere would be a 5 second delay when you run it. Can you do that in Python??? | |
I'm still grappling with the concept of passing parameters and returning responses. See code below: [CODE]#Measurement Converter # Converts Common Chinese Units of Measurements (Practicing function return) # Convert "cun" to "inches" def cun_to_inches(cuntoinchesQ): cuntoinchesUR = None while cuntoinchesUR == None: cuntoinchesUR = float(raw_input(cuntoinchesQ)) cuntoinchesUR *= 1.31 return cuntoinchesUR # … | |
Hi, I have written a program in python, and am looking to translate it into c++ code, here is the program: import random # You've got to guess 4 numbers between 0 and 30, if you get it right the program will output "WINNER" and tell you the computer's numbers … | |
I have a router mamangement requirement that requires a log file to be uploaded to a tFTP server. I wanted to do this using a python script. I have not been able to find a tFTP open source library anywhere. Does anyone know the where-abouts of one? | |
I would like to collapse whitespace in a string of the followinf foramat using a some pre defined functionalities. XXXXX<space>-<space>XXXX shoud be converted to XXXXX-XXXXX XXXXX<space>-XXXXX shoud be converted to XXXXX-XXXXX Please help | |
Dear All, How to write Batch file to Replace Pythonpath in Environment Variables. regards Mani | |
Hi! I just started poking around with Python recently, and I decided to do a text-adventure game project to practice some of the core concepts. Trying to think of ways to go about it, I stumbled on this DaniWeb post: [URL="http://www.daniweb.com/forums/thread55140.html&highlight=python+text+rpg+tutorial"]http://www.daniweb.com/forums/thread55140.html&highlight=python+text+rpg+tutorial[/URL] Gave me a lot of inspiration, and I took … | |
I have a problem guys. It's due to duck typing. Now I expected to run into something like this sooner or later, but I can't help but feel there's a better solution. [code=Python]import re def patternMatching(pattern, string): matchList = re.findall(pattern, string) print '\n'.join(['%s' % v for v in matchList]) [/code] … | |
Hi everyone! I'm new here, so just letting you know that. Anyway. I'm currently writing somewhat of a game in pygame and had a few questions for anyone who would be able to help me. I have created a python program that moves and object in a window, and I … | |
hi friends! i was searching for a base conversion script in python when i was stumped with the following code snippet [code language=python] >>> number = 1000 >>> hex2bin = {"0":"0000", "1":"0001", "2":"0010", "3":"0011", "4":"0100", "5":"0101", "6":"0110", "7":"0111", "8":"1000", "9":"1001", "A":"1010", "B":"1011", "C":"1100", "D":"1101", "E":"1110", "F":"1111"} >>> "".join([hex2bin[h] for h … | |
Hello, I am a new user to programming and to python. I have been trying to program for a while now, yet have been extremely busy for the past few months, and have done the minimum amount of work every day. But, I hope to be able to further my … | |
if i have a string e.g. string = "Hello\nWorld" and do list = string.split() '\n' would be ignored how can I preserve '\n' when splitting strings..? Thanks | |
Sorry to have to post two consecutive questions for other people to help me with, but I'm having a problem with winsound that I simply can't figure out. I've checked all the documentation I could, but there's no answer. The problem is with SND_PURGE. [quote=Python Library Reference]SND_PURGE Stop playing all … | |
[code=python]Y=1 N=0 cont=Y print "Welcome to SCLMIP(Simple Calculator For Linux Made In Python)" while cont == Y: equation=input("Equation: ") print equation cont=input("Continue? (Y,N)") else: print "Exiting..." [/code] If you type 5/2 you get 2, I want it to display 2.5. A workaround is typing 5.0/2.0, but it gets annoying. I … | |
Hi all, Could not work out if this belonged in the c++ forum, or the python forum.... Basically, I am writing an application in c++ which embeds python. The annoying thing is that I have no way of knowing in advance what version of python will be installed on a … | |
Me and my cousin are making a python text-editor. and im having trouble getting our program to work with py2exe and im not sure what the problem is. I set everything up like the py2exe website tell you to and it all went together perfectly fine. but when i try … | |
I have written a small code to parse and execute a sql statement but it fails to execute statement if it caontains ['<=','>='.'!=','<>'] how can i make changes in following regex. rawstr = r"""(.*)[( *)?]?([|=|>|<])[( *)?]?(.*)""" string_to_join="([ *]?and|[ *]?or|[ *]?not)[( *)?](.*)[( *)?]?([=|>|<])[( *)?]?(.*)" sql statement ="select name from table_name where … | |
Hi All, If anybody has worked on the custom tree control in wx.lib of wx python 2.7 and above, can you please help me in implementing the checkboxes in it as i'm unable to do so.... Regards, Dinil | |
Hi, this is my first post. Ive made a number game which is written in python 2.5 and have some problems with it: ------------------------------------- import random # You've got to guess 4 numbers between 0 and 30, if you one right the program will output "WINNER" and tell you the … | |
I have a question about the range function. How is it that the function has three parameters (start, stop, step), but the mandatory one (stop) is in the MIDDLE? I thought mandatory parameters have to be at the beginning, and optional parameters come afterwards? When I try to create my … | |
Hello there, again! Well, once I solved the stupid bug I had in my first Python class ever, now I'm getting results I wasn't expecting. The problem is: I instantiated two objects of this class but, apparently, one of the objects is just a copy of the other. And if … | |
Hello, I am trying to write a login script for a windows network that gets the groups that a member is part of from active directory in order to determine what drives to map. I am attempting to use Tim Golden's active_directory module to do this however when I try … | |
Hello! I'm studying Python and wrote a very simple class to work with bidimensional arrays - just as an exercise. Before writing te class I played around with functions and they worked fine. When I tried to do the same using a class, things became strange... Okay, I wrote this … | |
I'm just learning python and i'm trying to make a game where someone puts in 3 numbers and the program picks one of them at random [ICODE]import random print "Enter 3 numbers and i'll choose 1 at random" a = 0 b = 0 c = 0 nmlist = [a, … | |
Hi! I just started using Python yesterday and I have written a program that reads in a very large data file and rearranges the data so that it can be read into a different program. I am doing this for some engineering modeling simulations. I wanted to create an interface … | |
Ok, I would like to use a regular expression that I create dynamically to search and replace words in a file. For instance: import re fl = re.compile('abc|def|ghi') ts = 'xyz abc mno def' n = fl.search(ts) print n How would I find all matches in the string? So far, … | |
Hi. *** SHORT QUSETION: Is there a way I can run a <large> socket server withought having to have a thread for each client/socket created? ***LONGER EXPLAINATION IVe recently written a small network program, that sends messages over TCP or UDP... depending on user input. I want ot adapt that … | |
Hi, I have 2 modules, grepforapp.py and myApp.py. Basically i'm trying to make a 'search' utility. myApp makes the UI with one textbox for taking input, start button and a list box which displays the file names where the pattern was found. grepforApp walks through the dir tree and searches … | |
Dear All, I am trying to write the following code: def try1(n): a1="God Godess Borother Sister Family" a2=a1.split() a3=raw_input("PRINT A WORD") a4=a1.find(a3) print a4 a5=[] if a4>0: a5=a2.index(a3) a6=a5+1 a7=a2[a6] print "The new word is" print a7 a8=a5.append(a7) print a5 elif a4<0: a11=a3 print "The word is not availiable in … |
The End.