15,190 Topics

Member Avatar for
Member Avatar for Sandhya212

Dear all. I have a file with lines like this.[CODE] query 210 ACTTGGACTC 219 query 311 ACTTGGACTC 320 ....[/CODE] From every line, I need to extract the number coming right after 'query' and then the DNA sequence. I currently read each line as a list but was only able to …

Member Avatar for Sandhya212
0
176
Member Avatar for bettersaid

Is it possible in python to open all files in a directory? this only opens a particular file: [CODE]import os path = "/Desktop/directory/file.odt" temp = os.system("open " + path)[/CODE] how about this? am i doing it right? [CODE]import os mypath = "/Desktop/directory" temp = os.listdir(mypath) temp = [os.path.join(mypath, i) for …

Member Avatar for redyugi
0
129
Member Avatar for bettersaid

[CODE]import os from appscript import * this = app(u'System Events').application_processes[param1].windows[param2].exists() while True: this1 = app(u'System Events').application_processes[param1].windows[param2].count(each=k.radio_button) if count == (this1): this2 = app(u'System Events').application_processes[param1].windows[param2].radio_buttons[param3].click() try: os.makedirs(param1) except OSError: if os.path.exists(param1): this3 = os.system('screencapture -C '+ param1 +'/'+ param2) while True: self.param2 = os.path.join(param1, 'win%s_%s_img_%s' % (param1, param2)) return param2 + …

Member Avatar for bettersaid
0
186
Member Avatar for kimmi_baby

I've created a program with turtle graphics that has 3 functions. One draws rectangles, one draws squares and one sets the position. I'd like to create a function that fills in the shapes with different colours. I know about begin fill and end fill... but I would really like to …

Member Avatar for stevenpgrm
0
80
Member Avatar for bettersaid

f i opened a document in terminal through this [CODE]os.system("open " + pathName)[/CODE] how should i close it? is there something like [CODE]os.system("exit")[/CODE] or something Thanks

Member Avatar for bettersaid
0
76
Member Avatar for python_user

Hi Guys i have a situation where i need to have a options menu kind of thing. When they select some option in the menu i need to have a text-box/box which accepts only date/box which accepts only int beside it to accept the value I am trying to do …

0
55
Member Avatar for smittles

I am brand-new to Python, and this is my first post on DaniWeb. Seems like a positive community, and I hope one day to contribute as a knowledgable expert and not a world-class newbie. I'm wanting to create a simple python program that "fakes" Shakespeare or haiku-style output. I realize …

Member Avatar for TrustyTony
0
184
Member Avatar for ihatehippies

Is there a way to set an objects id or memory position? Ultimately I'm trying to change function "a" to function "b" while still preserving any saved reference to function "a"

Member Avatar for ihatehippies
0
167
Member Avatar for dustbunny000

Is there a logical operator in python for and/or of strings? I am trying to write a weasel code. What I have so far: [CODE]import random import math keys='abcdefghijklmnopqrstuvwxyz ' monkey='methinks it is like a weasel' def attempt(): attempt='' for i in range(len(monkey)): x=random.choice(keys) attempt+=x return(attempt) library_attempts=[] for i in …

Member Avatar for TrustyTony
0
99
Member Avatar for dustbunny000

Hi there. I am trying write a module that can be executed at the command line and for some reason it's not working. Does anyone know why? [CODE]import sys def fibonacci(N): a,b =0,1 while b < N: a,b = b, a+b print b N=sys.argv[1][/CODE] Does it matter that I'm running …

Member Avatar for TrustyTony
0
93
Member Avatar for pythonbegin

Dear All I am working with a tab-delimeted files - first two columns are pairs of identifiers and third column is floating point number (0-1) denoting interaction strength between colmn1 and 2. sample file is also attached. eg- column1 column2 column3 john steve 0.67588 john matt 1.00 red blue 0.90 …

Member Avatar for TrustyTony
0
103
Member Avatar for novice20

could anyone help me regarding calling different python scripts from within a main script.How can this be acheived? Thanks in advance

Member Avatar for cghtkh
0
227
Member Avatar for dustbunny000

for: [CODE]import random keys='abcdefghijklmnopqrstuvwxyz ' random.choice(keys)[/CODE] How would I count how many times it takes random.choices(keys) to generate "m"?

Member Avatar for D33wakar
0
167
Member Avatar for Wumbate

Here's a weird one: I have a Tkinter.Text widget that I import data from with inputText.get(1.0,END) However, later in the program I have the text in an array, but the array has values like: 'u\x00s\x00e\x00r\x00' Is there a way to decode this weird string to a normal string? I think …

Member Avatar for D33wakar
0
90
Member Avatar for moonlite25

I have this code: def rollBox(length, numDivisions, count): Angle = 90/numDivisions if count == 0: return elif numDivisions == 0: rollBox(length, numDivisions, count - 1) else: square(length) turtle.right(Angle) rollBox(length, numDivisions - 1, count) Is there any way to still decrease the 'numDivisions' parameter to zero while still keeping its original …

Member Avatar for TrustyTony
0
77
Member Avatar for novice20

could anyone please help me regarding how to add a newline character to the log file created using logging module. All the output is dumped onto a single line, which makes it unreadable. I s there any way to make the log file legible?

Member Avatar for TrustyTony
0
54
Member Avatar for darkwing

Hi all. I'm writing a simple GUI to display some text and update the text as I receive data from a multicast address. What I have is a Frame, and then a wxScrolledWindow that is using the Frame as its parent window. The scrolled window contains a vertical box sizer …

Member Avatar for darkwing
0
423
Member Avatar for ste_a47

I'd like to implement a functionality in an app of mine, but I don't know how to go about it. What I want is this: I have a model class that uses imagekit to save its images, and I'd like to have the users being able to update the images …

0
83
Member Avatar for MrAlshahawy

Hi all, I want to know the last event in log ; in other words , when I use this code below : [code] telephone.incoming_call() # waits for an incoming call telephone.call_state(handle_call) [/code] it calls the handle_call function when there is (Answering - Missed - Dialing - Ringing) events , …

Member Avatar for MrAlshahawy
0
84
Member Avatar for novice20

I am new to python n developing scripts as a part of my project.I need help regarding HOW THE OUTPUT OF THE SCRIPT CAN BE REDIRECTED TO A TEXT FILE(FOR MAINTAINING ERROR LOG), WHILE ALSO PRINTING IT ON CONSOLE?? Thanks for all the help in advance and I am looking …

Member Avatar for novice20
0
158
Member Avatar for Wumbate

Hi, I have a UI built in Tkinter. The user can type in some inputs and hit "Run" When the "Run" occurs, a program executes that could take 30 seconds or more! The problem is that this blocks the graphics updating. At the beginning, I set a Label to "Running …

Member Avatar for D33wakar
0
29K
Member Avatar for dustbunny000

[CODE]import math import random choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,\ 37, 38, 39, 40, 41, 42, 43, 44, 45, …

Member Avatar for TrustyTony
0
76
Member Avatar for bettersaid

helo! can anyone help me in automatically saving files with fixed filename in python? the OUTPUT would be like this: FILE- A01.txt FILE- A02.txt FILE- B01.txt File- B02.txt i was hoping that i could save a file automatically after making some changes in the older version. Thank you, Gene

Member Avatar for bettersaid
0
442
Member Avatar for marcom10

I need to write a mortgage calculator program that will find the amount of a monthly mortgage payment for a loan. [CODE] # Get information from user print 'CALCULATOR FOR MORTGAGE LOANS' loan_str = raw_input ("Amount of loan:") loan = eval(loan_str) years_str = raw_input("Number of years:") years = eval(years_str) rate_str …

Member Avatar for woooee
0
113
Member Avatar for lewashby

Program 1 [CODE]import math class Vectory2(object): def __init__(self, x = 0.0, y = 0.0): self.x = x self.y = y def __str__(self): return "(%s, %s)" % (self.x, self.y) @classmethod def from_points(cls, P1, P2): return cls( P2[0] - P1[0], P2[1] - P1[1] ) def get_magnitude(self): return math.sqrt(self.x**2 + self.y**2) def normalize(self): …

Member Avatar for snippsat
0
97
Member Avatar for moonlite25

Hi, I am coding a program to make a rolling box function using turtle graphics. The box is supposed to appear to be rolling across a floor to the right like this: [url]http://img194.imageshack.us/img194/2944/rollingbox.png[/url] There are supposed to be three function parameters: length for the length of a side, numDivisions for …

0
45
Member Avatar for dustbunny000

This might be dumb... but I'm having problems raising e to a negative number and I can't figure out what is going on. [CODE]>>> math.exp(((-23*(23-1))/730)) 0.36787944117144233 >>> math.exp(-506/730) 0.36787944117144233 >>> math.exp(-.69) 0.5015760690660556 >>> math.exp(-(506/730)) 1.0[/CODE] For some reason I keep getting different answers when they should all be the same... …

Member Avatar for dustbunny000
0
84
Member Avatar for lewashby

[CODE]import math class Vector2(object): def __init__(self, x = 0.0, y = 0.0): self.x = x self.y = y def __str__(self): return "(%s, %s)" % (self.x, self.y) @classmethod def from_points(P1, P2): return Vector2(P2[0] - P1[0], P2[1] - P1[1]) def get_magnitude(self): return math.sqrt(self.x**2 + self.y**2) def normalize(self): magnitude = self.get_magnitude() self.x /= …

Member Avatar for lewashby
0
112
Member Avatar for dragonflame17

I wrote this program for a class, the only problem is that it returns the anwser for assessmentValue twice. I can't figure out what to do to fix it...please help!! [code=php] def main(): #Get the actual value for the property. actualValue = input ("Enter the actual value of the property:$") …

Member Avatar for TrustyTony
0
105
Member Avatar for Monster Killer

Hello. I was wondering if there was a way to use python to convert a video to flash and add controls online. Like youtube, a user uploads a video and it gets converted and controls get added. I have looked online and everyone says "Use this extension blah blah blah" …

Member Avatar for Monster Killer
0
117

The End.