15,175 Topics

Member Avatar for
Member Avatar for Petee.bill

Hi Guys, Can anyone help me redo this, so it'll be a list comprehension instead? def parseAnnotation(annotation): ExonStartAndStop = [] d = annotation.split(',') for i in d: removeparenteses = i[1:-1] numbers = removeparenteses.split('..') ExonStartAndStop.append((int(numbers[0]),int(numbers[1]))) return ExonStartAndStop example usage: print parseAnnotation('(1834..2736)') ---> [(1834, 2736))

Member Avatar for Gribouillis
0
149
Member Avatar for apeiron27

my text file content looks sth like this: -title info~~~~ ~~~~~~~~` ~~~ -tittle info~~~~ `~~~~`` and so on.. the no of line in the info section is not constant. i want to pick the data with the right title and save it in another file i'm guessing i need to …

Member Avatar for ret801
0
62
Member Avatar for vikaram

Hello i made a phonebook script on python. I am quite new and have been only learning for less than a day and i cant get it to save the entered phonenumbers (is resets to default everytime you quit) Please help me with the code please! [CODE]phonebook["test"]=12345678 def searchname(): print …

Member Avatar for vikaram
0
322
Member Avatar for luofeiyu

there is a simple code,which can run locally ,and get three csv file in c:/ #coding:utf-8 import urllib import re import os exchange=['NASDAQ','NYSE','AMEX'] for down in exchange: myfile=open('c:/'+down,'w') url='http://www.nasdaq.com/screening/companies-by-industry.aspx?exchange='+down+'&render=download' file=urllib.urlopen(url).read() myfile.write(file) print 'ok',down myfile.close() i want to upload it onto my google app (i have one google app account)and let …

0
77
Member Avatar for natehome

ive been working on this script as a project, and when i run it and click on the button to sleep(its going to be an rpg game) it loops and sends the command a bunch of times through the function. [CODE] import sys, random, time, pygame from pygame.locals import * …

Member Avatar for ret801
0
256
Member Avatar for sys73r

[CODE]import urllib2 from BeautifulSoup import BeautifulSoup data = urllib2.urlopen('http://www.NotAvalidURL.com').read() soup = BeautifulSoup(data) table = soup("tr", {'class' : 'index_table_in' }) print table[0][/CODE] the result is: <tr id="index_table_12345" class="index_table_in"> <td><a href="/info/12345">string 1</a></td> <td><a href="/info/12345">string 2</a></td> <td><a href="/info/12345">string 3</a></td> <td><a href="/info/12345">string 4</a></td> <!--td></td--> </tr> *the goal is to get only the strings and …

Member Avatar for sys73r
0
24K
Member Avatar for Tcll

just making a thread that will hopefully stick for a while... >_> I just need a little help and need to know a few things before starting on this... the main thing being the need to know how to build a good update system >_> my program will have a …

Member Avatar for Tcll
0
124
Member Avatar for AdampskiB

[CODE]# 619480 import time from random import * def main(): lst = [] result, length = 0, 500000 while result <= 0.50: for i in range(length): lst.append(randint(1, length)) value = randint(1, length) t0 = time.clock() linearSearch(value, lst) result = time.clock() - t0 print("This LINEAR SEARCH took {0:4.2f}seconds with a length …

Member Avatar for AdampskiB
0
156
Member Avatar for TrustyTony

While looking into [URL="http://www.had2know.com/academics/gaussian-prime-factorization-calculator.html?blankone=2&result="]Gaussian primes [/URL]I came to think additional ways to check for is number integer or not, what you think is best way? [CODE]epsilon = 1e-11 def is_integer(n): """ traditional abs, epsilon check for near integer """ return abs(n-round(n)) < epsilon def is_integer2(n): return (float(n)- int(n)).as_integer_ratio()[1] == 1 …

Member Avatar for TrustyTony
0
291
Member Avatar for arunpawar

This is very basic issue with me right now. I don't know how to write a function or class in python. I mean i know the syntax but i don't know how to escape from the indentation while typing on IDLE. For example [CODE]def sum(): var1=10; var2=20; sum=var1+var2; #how to …

Member Avatar for arunpawar
0
357
Member Avatar for Cenchrus

Can someone tell me, step by step, how python interprets this code? [CODE] Numbers = [1,2,3,4,5,6,7,8,9,10] Numbers[8:3:-1] [/CODE] I know that the "-1" is the counting bit of it, and it goes in the negative direction, but I'm lost on everything else... :(

Member Avatar for Cenchrus
0
169
Member Avatar for natehome

can someone please look over this code and see if they can make it run faster. if you make any changes will you comment it so i can see what you did. this is a personal project. thanks you very much [CODE]#Image manipulation library from PIL import Image import datetime, …

Member Avatar for TrustyTony
0
149
Member Avatar for KrazyKitsune

Title says all. I need to make a code that gives the prime factorization of a number and put them in a (this is important) a list.

Member Avatar for TrustyTony
0
178
Member Avatar for Cupidvogel

Hi, I want to iterate over a list, printing each item and subsequently deleting it, so that at the end, the list is empty, while all the numbers are printed out. I have tried two tactics (to me the logic for both is the same, just checked to spot the …

Member Avatar for Cupidvogel
0
87
Member Avatar for wilhelmO

Hello and good afternoon. I'm new to python an Tkinter. My task : a triggered camera writes 12 images every 70 seconds in a specific folder. The newest 12 images should be visible in a frame at 12 labels ( labels are able to display images ? ). I made …

Member Avatar for Gribouillis
0
156
Member Avatar for jantrancero

What i want to build is this: Sending a command to another computer and get the results back on the computer where i started on. Additional info: I have a web server running with python on 192.168.10.100:5000. When i go to this address i get a web page and on …

Member Avatar for Gribouillis
0
3K
Member Avatar for Andr3

Hey all! I have some questions about pythons capability of processing video fails. I would like to run and edit some files with pythhon. Can i use pygame or wxPython or do i need some other libaries? And does somebody have some example codes or helpful materials of video processing? …

0
97
Member Avatar for vegaseat

Version 2.6 of wxPython has support for playing animated gif image files. The example sets up a panel on a frame and then uses wx.animate.GIFAnimationCtrl() to do the hard work. Actually pretty simple code.

Member Avatar for woooee
1
2K
Member Avatar for Cenchrus

I'm typing the code: [CODE] import cmath import math print r"pow(2,3) returns 2^3 pow(2,3,1) returns 2^3 modulo 1" pow(2,3) pow(2,3,1) [/CODE] and I'm getting this error: File "sample2.py", line 26 print r"pow(2,3) returns 2^3 pow(2,3,1) returns 2^3 modulo 1" pow(2,3) pow(2,3,1) ^ SyntaxError: invalid syntax Why is this invalid syntax?

Member Avatar for woooee
0
884
Member Avatar for ni5958

Hi, i need to write a recursive function which gets a list and an integer k and returns a list of all the possibilities of creating sub lists to the length of k with the elements from the original list. i hope i was clear enough.. here are some examples: …

Member Avatar for Gribouillis
0
3K
Member Avatar for hisan

Hi All i have downloaded "xmldiff-0.6.10" from their official site (http:// [url]www.logilab.org/859[/url]). I have tried installing the same on my 32 bit Windows 7 OS using the command "setup.py install" but below exceptions are thrown in the console. please help me out in installing this package on Windows Exceptions thrown …

Member Avatar for robert99x
0
157
Member Avatar for betty2

Hi, how best can one put different images on a stack to form a single array. For example, |image1.flatten()| |image2.flatten()| |image3.flatten()| So that each row of the array would be a specific image.

Member Avatar for TrustyTony
0
37
Member Avatar for Ismatus3

Hello everyone, I generate an executable for an application in Python with Tkinter interface , on my machine when I double click on the executable the application execute well. The problem arises when I move the entire file on another machine, while there on a machine that executable runs from …

Member Avatar for telmo96
0
123
Member Avatar for khajvah

Hello people. I learning phyton and have a problem. [CODE]def Cel2Fah(temp): Fahren = str((9.0/5.0)*temp+32); return Fahren;[/CODE] I was asked to write a function which converts celsius to fahrenheit([url]http://www.pyschools.com/quiz/view_question/s2-q5[/url]). It says: "Return a string of 2 decimal places", but i dont know how to.

Member Avatar for telmo96
-1
108
Member Avatar for MarkWalker84

Hi, got a quick quickie... Im trying to send commands to a micrcontroller via a USB->serial converter. Im writing with wxPython on an XP machine it thats important. I have been using the win32 module along with USPP and so far so good, apart from one thing. As far as …

Member Avatar for mr_snarf
0
2K
Member Avatar for pwolf

i have been working on this course work i got my hands on to learn python, and i have just been working on an exercise, i was wondering if i perhaps cheated though? The exercise says the following; write a function that takes a list of real numbers and returns …

Member Avatar for pwolf
0
289
Member Avatar for chris99

I'm having trouble with an application in Tkinter. The program displays a button that has a picture on it and that button takes you to a website about that picture, but that is not where the issue lies. There is another module that I have found on an internet tutorial …

Member Avatar for chris99
0
2K
Member Avatar for BnayaArbel

Hii im Python Programmer , and i want to start write application to android operating system. i can to develop with python? and i want that the Client will be run the application without something installed before (Like Python interepter and etc) How i can ? Thnaks!

Member Avatar for Tech B
0
138
Member Avatar for WolfShield

Python was my first programming language and I have been programming for about 5 years now. I LOVE Python, but there is one thing I haven't got myself to believe yet. In the Zen of Python one of the entries is: "There should be one, and preferably only one, obvious …

Member Avatar for WolfShield
0
241
Member Avatar for tcl76

hi, i would like to parse an input file (input.txt) into output file (output.txt) which i'll into excel. appreciate any advice on how to parse the input.txt into output.txt. thanks johnny

Member Avatar for tcl76
0
219

The End.