15,181 Topics
| |
Hi everybody, I completed my scripts and I managed to compile them with py2exe. This script will edit some images and will save the output in a specific subfolder of the program (if the user will install it in the default location it will be something like c:\program files\MyProgram\output The … | |
I'm trying to get the available disk space on a remote linux host using python. The best way I could think to do this would be to os.popen a df command, and use regex to get the available space from the output. I then need to apply a variable to … | |
Hello everyone For my bioinformatic course i have to make script that allow user to open pdb file (its a file containing gathered information about proteins, all files have same structure) and look for number of subunits. To put it even more simple it has to check if there is … | |
Hi there, how can I read a file line by line till the 150th line? I mean, I know the [CODE]for line in f:[/CODE] but I want to read only (let's say) 150 lines of the f file. Thanks a lot | |
We are very excited to announce the launch of [URL="http://www.pygamezine.com/"]PyGameZine[/URL]! PyGameZine issue 0 is chock full of articles about pygame, and interviews with people using pygame. It was inspired by the magazines that people used to type code out of into their comodore 64s, or z80 spectrums plugged into their … | |
Hey guys, I know this will have an easy answer, but I have been awake far too long to see it :P I am doing some coding with classes in python, and it just isn't working. Here is the code: [CODE] from bpy import * from os import * from … | |
Dear all, I wrote 2 scripts and at a certain point of the first I would like to run the second, and when the second is done, to go back to the first and continue with it. How can I do it? I put at the desired point of the … | |
I'm trying to find degrees of separation between any two actors in a movie database. I succeed when I reach my base case, which is 1 degree of separation (i.e. actor is in same movie as another actor) but I use recursion to find all other degrees of separation, and … | |
I have written almost all of my program, except I am stuck on this certain part. I need to write an averege out to figure all students final grades out as a statistic of the course. Students name and final grade have been appended to an external file(keep in mind … | |
I just completed an assignment, and both scripts function the same ultimatley, but just wanted to know if there were any potential differences, or is it just a matter of style? [CODE] if num % 2 ==0 : new = num //2 num = new print(num) count = count +1 … | |
Hi, I am using the command in python from a linux system: [CODE=python] import os os.system('grep "^[0-9]" data.txt | wc -l') [/CODE] The output of this is an integer like 115. Can I assign this to a variable somehow? For example: x=os.system('grep "^[0-9]" data.txt | wc -l') DOES NOT WORK. … | |
Hey guys I need some help with making the iframe be dynamic with the webpage. it is in video_page and I cant seem to get around it. here is the code: [code] def video_page(self): return """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" … | |
Hi - I know that this has been somewhat discussed in a couple of threads, but I haven't seen anything with an actual answer. What would the design or pseudocode look like? Write a program that checks HTML files to determine whether the embedded XHTML tags are balanced. The program … | |
I've been asked to write a program that computes the nth Fibonacci number where n is a value input by the user. For example, if n = 6, then the result is 8. This is what I have so far: def main(): print "This program will compute nth Fibonacci" print … | |
Hi,I was wondering how to read and write strings in python. I have this code where I'm creating a path, but its a string, and now I want to write to this string. But keep getting this error message [I]AttributeError: 'str' object has no attribute 'write'[/I] I was thinking about … | |
Hey, I'm new to Python programming and I've been making a simple rock paper scissors program for practice. I've managed to get it working; it asks the player to enter 'a' for rock, 'b' for scissors or 'c' for paper. If the player entered a, b or c, a number … | |
..uhm...hello...i'm new to python programming and I really want to explore more about this... ...i just want to know what is the best compiler I can use for this... | |
how can i compare 2 string for bull hit game in python. i wrote the program itself. how can i find how many hits and bulls i have. [CODE]import string import random import re m = input (' Please input the long of the string you want to guess :') … | |
Hey guys, I need to print a dictionary from a text file and than print it again with the last two values updated in each row. The text file appears as so: 12345678 Joe Dokes IT 30 95 87654321 Sally Sue ISYS 50 87 34876293 Bo Burnham MATH 60 78 … | |
I need to write a small bit of code that will print an error if I cannot resolve the name to IP. I see that you can use the "socket.gethostbyaddr" methods but I cant seem to find a simple method/exception for when it does not find an IP address. Also … | |
Hi every body. I want to make a topographical image from a 2d Aerial photograph. how can I do it in python? Thanks if help me. | |
Hi, i'm python beginner. how to make that only use def, for, list, while .. [CODE] def comb(n,r): if r == 0: return 1 elif r == n: return 1 else: return comb(n-1,r-1) + comb(n-1,r) [/CODE] this code is very slow.... ah , I have to use recursion .! please … | |
Task: • Create a text file with 5 questions in it. • Read each question in from the file. • Ask the user for their response. • Create a new text file. • Write the user’s answers to the text file. • Ask the user if they’d like to review … | |
Hi all - I need to write a code that reads in a 20 line file 4 lines at a time, and puts the five sets of 4 strings into their own individual strings. So there should be five strings containing 4 strings each. I am very confused and havne't … | |
Hi all, I have text file as follows... >s1 MPPRRSIVEVKVLDVQKRRVPNKHYVYIIRVTWSSGATEAIYRRYSKFFDLQMQMLDKFP MEGGQKDPKQRIIPFLPGKILFRRSHIRDVAVKRLIPIDEYCKALIQLPPYISQCDEVLQ FFETRPEDLNPPKEEHIGKKKSGNDPTSVDPMVLEQYVVVADYQKQESSEISLSVGQVVD >s2 MAEVRKFTKRLSKPGTAAELRQSVSEAVRGSVVLEKAKLVEPLDYENVITQRKTQIYSDP LRDLLMFPMEDISISVIGRQRRTVQSTVPEDAEKRAQSLFVKECIKTYSTDWHVVNYKYE DFSGDFRMLPCKSLRPEKIPNHVFEIDEDCEKDEDSSSLCSQKGGVIKQGWLHKANVNST . . . I wanted to count letter 'P' in each sequences output should be > s1:10 > s2:20 To acheive this python script as follows infile=open("file1.txt",'r') out=open("file2.csv",'w') for line in infile: line = … | |
Hi, I have written a program that searches through a text file and in the end I want it to give me some probabilities. In my program I'm searching (for each line) for certain characters and if that character exists then extract the probability. The thing is that sometimes this … | |
I'm confused on how i can change or "toggle" the text of a button from say "D" to "A" when clicked, and then back to "D" if clicked again. So far I have this: [ICODE]from Tkinter import * from tkFileDialog import * class Game(Frame): def __init__(self,root): Frame.__init__(self,root) self.grid() self.buttons() def … | |
Hi guys I'm trying to place a user input into a database(mysql) [CODE]newplayer=raw_input('Please enter a new player name: ")[/CODE] the sql commands to insert data is [CODE]sql="""INSERT INTO PLAYERS(NAME) VALUES('newplayer')"""[/CODE] When i check the database it shows newplayer instead of what the user has entered. any ideas of how i … | |
Hi All, I want to create a pattern like this using python.. [CODE]Aa0Aa1Aa2Aa3Aa4Aa5......Ab0Ab1Ab2.........and so on.[/CODE] Thanks... | |
[code=python]import random secret = random.randint(1,99) guess = 0 tries = 0 print "AHOUY! I'm the Dread Pirate Roberts, and I have a secret!" print "It is a number from 1 to 99. I'll give you 6 tries. " while guess != secret and tries < 6: guess = input("What's yer … |
The End.