Forum: Python 11 Hours Ago |
| Replies: 3 Views: 66 It should be simple with Python's gstreamer interface. http://pygstdocs.berlios.de/ |
Forum: Python 11 Hours Ago |
| Replies: 7 Views: 81 Not enough info for anyone to help (could be an indentation error, or could be in the calcs). First add some print statements for the individual calcs to isolate the error, and post the specific... |
Forum: Python 19 Hours Ago |
| Replies: 7 Views: 94 Do you have to use something like queue_draw() to update the widget? The pygtk.org site has been down for 2 days now, so can't look it up, but try it and see.
Just write a simple program using... |
Forum: Python 1 Day Ago |
| Replies: 8 Views: 144 finderGuess = finderGuess - ((((finderGuess*((1+finderGuess)^numberMonths))/(((1+finderGuess)^numberMonths)-1))-
(monthlyPayment/loanAmount))/(((((1+finderGuess)^numberMonths)-1)
... |
Forum: Python 1 Day Ago |
| Replies: 9 Views: 264 There are several online pages to do that.
http://primes.utm.edu/curios/includes/primetest.php
is one found on this very good page
http://primes.utm.edu/
Your program works correctly, at least... |
Forum: Python 2 Days Ago |
| Replies: 9 Views: 173 All data is binary. That's the way the computer does it. I am assuming that you mean bytes that are not text. If you look at an ASCII table like this one http://www.asciitable.com/ it becomes... |
Forum: Python 4 Days Ago |
| Replies: 9 Views: 264 Wouldn't this lead to an infinite loop. def Prime(x,y):
n=2
if x == 1:
Prime(x+1,y)
elif x == 2:
print (2)
Prime(x+1,y)
elif x <= 0:
print ("Number must... |
Forum: Geeks' Lounge 4 Days Ago |
| Replies: 667 Views: 73,221 Via CNet
On average, cell phone users in the United States buy new gear every 18 months. In Japan, it's about 9 months. In Europe, cell phone users get new phones every year. |
Forum: Python 4 Days Ago |
| Replies: 5 Views: 138 Take on something that is easier first. If you have no idea at all on how to start, then there is little that anyone can do. |
Forum: Python 5 Days Ago |
| Replies: 1 Views: 153 Start with something like this (Not Tested).energyFile = open("EnergySources.csv","r")
state_dict = {}
for line in energyFile:
line = line.strip()
fields = line.split(",")
state =... |
Forum: Python 5 Days Ago |
| Replies: 7 Views: 213 Since you are using python 2.x, this won't work. Test this code by entering "R1" and "1/01/2000" and see what happens ( and look at "Is there an easy way to do user input in python?" here... |
Forum: Python 5 Days Ago |
| Replies: 7 Views: 213 |
Forum: Python 6 Days Ago |
| Replies: 2 Views: 157 Some corrections to get you started, provided the indentation is correct.def encrypted_message():
## "message" has not been defined in this function
char = message
encrypted_message =... |
Forum: Python 6 Days Ago |
| Replies: 8 Views: 194 You want to use "readlines()",as readline reads one line at a time, where readlines() reads all data. Also, a print statement is added for clarity.records = open(grades.txt,'r').readlines()
table =... |
Forum: Python 6 Days Ago |
| Replies: 3 Views: 145 And it's not tough to do. import Tkinter
root = Tkinter.Tk()
root.title('Canvas')
canvas = Tkinter.Canvas(root, width=450, height=450)
canvas.create_oval(100,50,150,100, fill='gray90')
x =... |
Forum: Python 9 Days Ago |
| Replies: 6 Views: 241 If you don't know how to open and read a text file, then look at one of the online tutorials like here http://effbot.org/zone/readline-performance.htm Then get the input from the user, etc. ... |
Forum: Python 9 Days Ago |
| Replies: 4 Views: 162 This is very simple to do. print len(set([1,2,4,2,7])) |
Forum: Python 11 Days Ago |
| Replies: 5 Views: 227 Google came up with this site which has a link to download source code. I hope you didn't pay $99.95 for the book! http://www.jbpub.com/catalog/9780763746025/ |
Forum: Python 11 Days Ago |
| Replies: 4 Views: 224 First, you have to decide which GUI toolkit you want to use. Here's an example Google found using Tkinter http://code.activestate.com/recipes/124894/ |
Forum: Python 11 Days Ago |
| Replies: 11 Views: 294 You can modify it on startup by adding PYTHONPATH to your ~/.bash.rc file, or create one if you don't have it.
export PYTHONPATH=$PYTHONPATH:/path/to/add:/second/path |
Forum: Python 14 Days Ago |
| Replies: 6 Views: 263 When validating, you want to include, not exclude. So you want a list of data that is acceptable, and the input has to be in the list. That way, when another unit or type of data is introduced it... |
Forum: Python 14 Days Ago |
| Replies: 7 Views: 228 Always use absolute path+file names.filePath = "Dataset/parameter feature vectors"
for fname in os.listdir(filePath):
complete_name = os.path.join(filePath, fname)
data_str =... |
Forum: Python 14 Days Ago |
| Replies: 2 Views: 142 Since you are testing 6 letters total, you want to use "len(w)-5" so you won't run out of letters. To set up an example using "aabbcc" as the simplest example, you only want the for loop to test the... |
Forum: Python 15 Days Ago |
| Replies: 1 Views: 253 You want to use a class structure for this, so each player can be an instance of the same class, and divide the code into several small functions. if numatt not in [1,2,3]:
raise... |
Forum: Python 16 Days Ago |
| Replies: 9 Views: 262 Alternatives would be: while (play_choice < 1) or (play_choice > 3):
while play_choice not in [1, 2, 3]:
# Also, you can use .lower instead of 2 compares
while play_again.lower() == 'y'': |
Forum: Python 16 Days Ago |
| Replies: 2 Views: 192 You can set the encoding for the file
fp = codecs.open('test', encoding='utf-8', mode='w')
Or you can change the default encoding for the system
sys.setdefaultencoding('utf-8')
You may have... |
Forum: Python 19 Days Ago |
| Replies: 16 Views: 366 You'll have to post your code as no one can tell what to do without code (Doh). If you are using a function, the function would return the length which would then be compared with the existing... |
Forum: Python 20 Days Ago |
| Replies: 8 Views: 198 Using for() loops is easier. This is somewhat of a brute force method but works fine for smaller lists. L1=[[1,2,3],[4,5,6],[7,8,9],[10,11,12]]
L2=[1,2,3,4,11]
L3=[]
for number in L2:
... |
Forum: Python 20 Days Ago |
| Replies: 16 Views: 366 This is a modified version of your program that prints what you expect. I am not sure if it is what you want or not. def tryit(start, end):
number = start
## number >= start
## number... |
Forum: Python 22 Days Ago |
| Replies: 6 Views: 3,112 Roman to integer. Note that it will take something like XXIXV and convert it. If someone already has a routine to check for valid input, please post it. And I'm afraid we've just eliminated one... |
Forum: Python 22 Days Ago |
| Replies: 6 Views: 227 I'll save the pun for one of your posts. And it's now too late to change it. Oh well, we'll just have to let this thread wind down the list into obscurity. |
Forum: Python 22 Days Ago |
| Replies: 3 Views: 219 You can pipe top to a file on Linux and then read the file.
Apparently you can use WMI for MS WIndows but I have not used it http://timgolden.me.uk/python/wmi_cookbook.html#running_processes |
Forum: Python 22 Days Ago |
| Replies: 6 Views: 227 Please ass "Solved" to the thread title so no one else wastes their time on this. |
Forum: Python 23 Days Ago |
| Replies: 12 Views: 421 Dictionaries are indexed via a hash and so make it easy to look up things, in this case the stock symbol, without going through the sub-strings in each list. Also, they provide a convenient way to... |
Forum: Python 23 Days Ago |
| Replies: 6 Views: 227 Can you use a list instead of all of those variables? Otherwise, try the code below which tests each button individually instead of the confusing and, and, or, etc. in your code. Speaking of... |
Forum: Python 23 Days Ago |
| Replies: 12 Views: 421 Doug Hellmann has excellent write ups. http://www.doughellmann.com/PyMOTW/
As far as books go, I like "Dive into Python" http://diveintopython.org/native_data_types/index.html#odbchelper.dict |
Forum: Python 23 Days Ago |
| Replies: 1 Views: 187 This is a forum for the Python programming language. Your question should be asked at the swarmplayer site, or on a board for the distro that you are using. |
Forum: Python 23 Days Ago |
| Replies: 12 Views: 421 This will get you started, but a dictionary would work much better for this. elif stChoice == 2:
for stock_list in portfolio:
print "symbol = %s for %s" % (stock_list[1], stock_list[0])... |
Forum: Python 24 Days Ago |
| Replies: 2 Views: 212 longLength = 0
for i in range(startNum, stopNum + 1):
longLength = hailstone(i)
if i >= longLength:
longLength = i
... |
Forum: Python 24 Days Ago |
| Replies: 7 Views: 369 This appears to work, but is still rough and just a proof of concept. It adds the unit to a dictionary as it's arrive time is reached, so that any finished units can be deleted from the dictionary... |