15,406 Topics
![]() | |
[B][COLOR="Red"]if param[0:4]<>'ini=': print ' %s ini='%sys.argv[0] sys.exit(1) inifile=param[4:] [/COLOR][/B] Hi All, Can u explain wht actually above code work? Thanks in Advance. | |
Okay I don't get this problem at all: [code=python]import random def chance(number): number = input for each in xrange(number): n = random.randrange(100)+1 return n def extreme(x): z = x + 5 y = z - 3 return z, y #main repeat = 0 while repeat != 2: x = input("Enter … | |
I'm currently doing a projecteuler problem, which requires finding the sum of all the primes below two million. I have a primitive function which determines whether or not a number is prime. This function is incorporated into the below function to produce a list with all the primes below the … | |
Hi I'm wondering how I would go about creating a program that will input data from about 1,000 files containing data such as this: [code] 2.825 1.00697992588 2.875 0.952989176901 2.925 0.91428970229 2.975 0.890110513425 3.025 0.879731596138 3.075 0.959217137445 3.125 1.07391392796 3.175 1.04874407027 3.225 0.857693793906 [/code] I'm wanting to generate an average … | |
Is there any way I can get an image to play in python with a function? Like I link the Python Code to the site with the picture on it or link it to my documents? I've tried researching it but I've gotten no results and I thought one of … | |
Does anybody know a good way place to find developers for an open source project? ![]() | |
Ok, so I have a project that I've written in Python(Actually it's not done yet), its the card game "Cheat" that you play in the command prompt with (until I learn wxPython -- GUI for Python) with computer players (or other people with you). I want to distribute it later, … | |
Hi. I'm a programming newbie. I'm pretty comfortable with most of procedural programming and understand the basics of OOP. Do you think I should try GUI programming? Also I would like some good advice on the best GUI toolkit to use with python and a link to a good tutorial … | |
HI I'm not an expierenced python programmer (yet) I want to display an image on a screen. I already installed PIL 1.1.6, and i am using the Tkinter GUI. I don't know what is missing (or were I went wrong installing the PIL), but this message <see below> is popping … | |
I have been in some tutorials for socket Module. It is very interesting. I want to know what I need to Know to make simple peer to peer/Client server Chat software but I'm new to Network, so anything that will help me put things together? Thanks Guys :) | |
I have written one python script for each test case. Now I want to have another script that runs all the test cases one by one, and output the result of each test case to a file. How should I start? | |
Hi everyone, As a personal project I've decided to write a small script which will take a raw_input film title, then look up the IMDB rating and return the result. As an extra challenge I decided to employ re. Now, this is how far I have got (yes, I am … | |
Is there any way to save to progress of a Python Program onto an I.P. Address or Harddrive? Like if you enter '5' into a program that multiplies your number by 3 and save it, your saved number would be 'x' when you reopen the file. I need help! :) ![]() | |
I have written code to compute the discriminant of a polynomial f(x) using the determinant of a sylvester matrix which for f(x)=x^5 -110*x^3 +55*x^2 +2310*x +979 looks like [CODE] [[ 1 0 -110 55 2310 979 0 0 0] [ 0 1 0 -110 55 2310 979 0 0] [ … | |
Hello, I'm using wxwidgets under linux. When I use the wx.Toolbar I wraps around the largest icons on the toolbar. When I try to set the size of the icons (through SetToolBitmapSize) nothing changes. Any ideas why this doesnt work in my code? [code] self.Toolbar=wx.ToolBar(panel,-1,style=wx.NO_BORDER) self.Toolbar.SetToolBitmapSize((21,21)) self.Toolbar.AddTool(-1,wx.Bitmap('/home/bart/python/icons/open.png')) self.Toolbar.SetToolBitmapSize((28,28)) self.Toolbar.Realize() [/code] … | |
Hi - This is a simple problem, I'm sure, but I'm stumped. I need to read only one column from a multi-column file. The column is always in the same position, so I've decided to simply isolate the location in the row while reading the data. Here is my code: … | |
I have a HUGE text file (over 60,000 lines) and I'm using python to do regex fixing on the file. I want to wrap any lines over 100 characters, and wrap on a space. I know I can use ".{100}" to find 100 characters but when I do this: [code] … | |
I am using psycopg2 to read from one database table and insert these into another table. I get a format error when the value I am trying to insert has a space in it. The condensed code looks like: cursor.execute("""INSERT INTO table (column1, column2) VALUES ('start finish','now later')""") I'm a … | |
When I try and run xrced.py, I get the following errors in IDLE: Please, what am I doing wrong? Thanks! IDLE 2.6.1 ==== No Subprocess ==== >>> Traceback (most recent call last): File "C:\Python26\wx-2.6-msw-unicode\wx\tools\XRCed\xrced.py", line 23, in <module> from globals import * File "C:\Python26\wx-2.6-msw-unicode\wx\tools\XRCed\globals.py", line 7, in <module> from wxPython.wx … | |
Hi all, My name is Erik. I'm new here. I was just wondering if anyone could give me any advice on a strange ftp problem I am having. Most ftp connections (through ftplib) if I put the wrong username and password in they raise an error my try except catches … | |
I am tryingto download a file from the server ,I dont know why i m getting the following error localFile = open(localFileName, 'wb') TypeError: coercing to Unicode: need string or buffer, type found Any clues..? Thanks | |
Here is some code I have been working on for an assignment, basically it finds prime numbers in between two variables-in any case, I have been trouble figuring out a way to restart the program based on user input. Basically the user inputs y to restart and n to quit. … | |
Hello, Is there a way to read an imagefile into a binary string? I know I can use [code]open(FILE,"rb")[/code] but this produces something unreadable that looks a bit like hexdata (I'm a newbie here :-). What I am trying to accomplish is to convert it to a string of ones … | |
Greetings; I would like to install Python, wxPython, XRCed, BoaConstructor : I installed Python 3.0.1 : but which version of the others go together with Python 3.0.1? Maybe I should backup with Python, but I don't know. Please Help. Thanks! ...Vern | |
Python26 with wxPython, wxWidgets(if need?), XRCed: Where to download compatibles ? Which version goes with which?? Please; I am trying to install Python26 with wxPython, wxWidgets(if need?), XRCed . But am having trouble figuring out what versions go together. Here is my Directory layout so far: Directory of C:\Python26\ DLLs … | |
Hey I am trying to use Python to control a motor over RS232 (serial ports). It is connected to COM3, and the connection settings are correct (baud=9600, etc). I am using pySerial in Python 2.5. My code is: [code=python] import serial, time # the serial port connections - customise as … | |
Hi, I have the following structure of my project [code] Copyproject(main folder) | |_____src(folder) | | | |__Nertworkpackage | | | | | |__Storepackage | | | | |__FtpPackage |__module1.py | |__module2.py |____ tests |__ module3.py [/code] Module1 takes some commandline parameters that will do some operation Like If I … | |
Hi guys, I wonder if any of you can help me with my problem.... I am trying to write a script that searches a file that describes a grid of letters, like: [code] wergfdghytr bhgiusuwiee popeldorlfse funwrdtywa [/code] The script uses another file for a word list, where each line … | |
I need help with python programing, i finished the first part of my project ans some of the second part, but im really confused about the part where i have to group an entire file into its constituent months and then calaculate the averages. I know how to calculate the … | |
Okay, don't laugh. I'm [B]very[/B] new to python. Actually to programming all together. I'm doing an exercise where i have to count the number of a string in a word. Ex: count("is", "Mississippi") would be 2. I tried using string.find and was having no luck. So i tried to go … | |
Hi folks. I'm getting back into learning Python after a few months off, so I'm still a newbie, hehe. I'm using the free online book Dive Into Python. I ran the first program and it worked just fine, but it returned the output in the opposite order of the one … | |
I have a program that uses UDP for inter process communication. I would like to setup python to listen for that program's data gram output and have my script send a copy of that data to any port it wishes. This needs to be two way communication such that my … | |
A simple game written in Python using Alpha-beta pruning algorithm. It’s also an experimental program for my py & wxpython study.I just start to study python couple months ago:) So..all the suggestions about this game will be welcome. more details and download links plz visit: [url]http://www.kavingray.com/blog/simple-tic-tac-toe/[/url] written by Python 2.5.2 … | |
I just finished another assignment and I can't figure out why this none keeps appearing after you enter a language: [code=Python]while True: print"Hello, how are you?" language=raw_input("Pick a language: french, german, hungarian, dutch: ") if"french"in language: def function(): print"Bonjour, comment allez-vous?" elif"german"in language: def function(): print"Hallo, wie geht es Ihnen?" … | |
I am using a tool to connect to mobile phone to fire AT commends . This tool has some ready adaptable .apy files which the user can modify and adapt to his needs. The scripts in the tool are written in Python. I am new to Python. Questions: ------------- 1. … | |
I've been racking my brain on this problem for like 2 hours. The thing I have to do here is use one single random function for the entire MASH program instead of the usual 4. The problem is, when I get a result, they're all from catagory 1 (married to … | |
yea, this is long.. but how do i make this repeat? At the end it's suppose to ask "do you want to do this again, y for yes, n for no" where yes is repeat from the beginning and no is exit. I think i messed it up............................ someone help? … | |
Hi, I found a code that displays multiple images but you have to supply its filename first before it can access it. Is there a way to display an image as soon as it is captured by the camera? The GUI that I am creating is going to be interfaced … | |
Okay so I'm trying to do this programming assignment and my random function isn't working. It's exactly the same as in my other assignments, but it's not working, and I've spent hours searching it. Can someone help me? [code=syntax]import random repeat = 0 while repeat != "no": random = input("How … | |
[INDENT]Hey All, This is my first post, so I'll do my best... I'm writing a Python app (using wxPython for the GUI) to copy large amounts of files. Each file is about 8-15 MB and there could be as many as 150,000 files. I'm currently using shutil (either [icode].copy(), .copy2() … | |
This is program i made (basic mash); I want to make it so that the program will ask if you want to repeat it again. "n" = exit. and anything else makes it repeat.....can someone help me? I'm not sure how to do it ... [code=syntax] x = 0 import … | |
I have some strings like '/home/dir/file1/file2' , '/export/home/file1' '/home/dir1/dir2/folder1/file' I want to only to print the values that come after first two occurences of '/' like for first string '/home/dir/file1/file2' I want to print 'dir/file1/file2' How to do this Thanks | |
Hi, I'm trying to print two arrays to a file, these are pretty large. However I want to print them as two lists. This is an example of what my output is now: [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. … | |
Hi I'm new in this community. I am working on a GUI using wxPython and I would like to embed an Image-to-Video converter in my program by pressing a button. Is this possible? If yes, can someone please send me a code? I will really appreciate it. Thank you so … | |
i want to print string(given as input) as number(o/p) and i did it in c using switch case .i want to do the same in python... wat if python provides switch case??n do we have equivalent of it in python?? Examle: input:three hundred and fifty(string) output:350(number) | |
Hi I want to print something like this to the standard o/p I am currently doing sys.stdout.writelines("%s %10s %10s\n" %(Folders['Table']['Table'][i]['name'],Folders['table']['table'][i]['data']['Place'],Folders['table']['table'][i]['data']['Age'])) but is not very well formatted how do I maintain column structure here ====================================================== Name Place Age ====================================================== John US 11 Mary UK 12 Mike US 14 How to do … | |
I am trying to spilt a message in two, if the number of characters is greater that 600, so that each message has no more than 600 characters. How can i do this i know how to get the message length [CODE] Message = "sdkfhdslkfhdskfhsdlfjsdlk" print len(Message) [/CODE] but i … | |
Hi all! I can not find my way around disabling widgets in pygtk. Is there one way for all type of widgets to disable them? By disabling I mean not being able to edit an entry and it is "grayed out", or the same for a checkbox, combobox and so … | |
As the title says, I need help on how to generate random numbers. Like say, if the program asks the user "How many random numbers do you want?" and the user enters "4" It would generate 4 random numbers. How do I do that? the programs outputs random numbers on … | |
I am programming a folder synchronizer for my first python project. (I want to get it finished before school starts in about 2 months. heh heh) Anyway, up till now my synchronizer will only copy file from one folder to another. I want it to be able to copy entire … |
The End.