15,181 Topics

Member Avatar for
Member Avatar for giancan

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 …

Member Avatar for giancan
0
263
Member Avatar for ryan461

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 …

Member Avatar for Gribouillis
0
183
Member Avatar for Blazko89

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 …

Member Avatar for Blazko89
0
95
Member Avatar for giancan

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

Member Avatar for giancan
0
190
Member Avatar for pygame

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 …

0
74
Member Avatar for metalix

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 …

Member Avatar for metalix
0
274
Member Avatar for giancan

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 …

Member Avatar for giancan
0
184
Member Avatar for RM@Bowdoin

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 …

Member Avatar for Gribouillis
0
2K
Member Avatar for my_py

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 …

Member Avatar for my_py
0
170
Member Avatar for as3g

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 …

Member Avatar for Gribouillis
0
152
Member Avatar for eternalcomplex

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. …

Member Avatar for Gribouillis
0
49
Member Avatar for bibidiboo

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" …

0
65
Member Avatar for C@un5el@r

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 …

Member Avatar for TrustyTony
0
475
Member Avatar for MakingMoney

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 …

Member Avatar for TrustyTony
0
2K
Member Avatar for sofia85

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 …

Member Avatar for Gribouillis
0
235
Member Avatar for Cheese7

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 …

Member Avatar for Cheese7
0
152
Member Avatar for draven07

..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...

Member Avatar for draven07
0
246
Member Avatar for Shady Baddarni

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 :') …

0
89
Member Avatar for bigredaltoid

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 …

Member Avatar for bigredaltoid
0
133
Member Avatar for felix001

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 …

Member Avatar for Gribouillis
0
221
Member Avatar for funfullson

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.

Member Avatar for hughesadam_87
0
115
Member Avatar for ERINY

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 …

Member Avatar for TrustyTony
0
1K
Member Avatar for Jetster3220

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 …

Member Avatar for woooee
0
315
Member Avatar for bigredaltoid

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 …

Member Avatar for bigredaltoid
0
164
Member Avatar for sainitin

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 = …

Member Avatar for woooee
0
192
Member Avatar for sofia85

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 …

Member Avatar for Gribouillis
0
148
Member Avatar for effBlam

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 …

Member Avatar for effBlam
0
179
Member Avatar for Zeref

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 …

Member Avatar for TrustyTony
0
93
Member Avatar for debasishgang7

Hi All, I want to create a pattern like this using python.. [CODE]Aa0Aa1Aa2Aa3Aa4Aa5......Ab0Ab1Ab2.........and so on.[/CODE] Thanks...

Member Avatar for debasishgang7
0
259
Member Avatar for usdblades

[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 …

Member Avatar for Gribouillis
0
260

The End.