On Jan 22, 2008 5:10 PM, Damian Archer <[EMAIL PROTECTED]> wrote:
> So anyone have any good project ideas, perhaps projects that people have
> undertaken before??
>
>
I'm taking a Java class this semester and our first program is a number
translator. Here's the assignment:
*Below is a sample
Easy enough. You'll want to import the random module and use the functions
in it. Also, http://docs.python.org/lib/lib.html is going to be your best
friend. You'll notice on that page among many other things is a section on
random number generation.
As to your code:
>>>import random
>>>a = ran
Inserting this line:
self.listbox2.InsertItems([choice],0)
in your OnListBox1 method after your if/then/else statement puts the item
you select in ListBox1 appear in ListBox2.
You have to force choice into a list, otherwise it will insert each
individual letter in the string into the box one at
Are you sure? From the link you provided it looks as if:
*stat*( path) Perform a stat() system call on the given path. The return
value is an object whose attributes correspond to the members of the
statstructure, namely:
st_mode (protection bits), st_ino (inode number), st_dev (device),
st_nlink
Interesting.
As Michael suggested this works, mostly:
from time import sleep
def loop():
x = 0
while 1:
print "x:",x
x += 1
sleep(0.5)
if __name__ == "__main__":
while 1:
try:
loop()
except KeyboardInterrupt:
print "Nop
A nice tutorial on using regular expressions in Python:
http://www.amk.ca/python/howto/regex/
On 7/15/07, bhaaluu <[EMAIL PROTECTED]> wrote:
Hi!
http://docs.python.org/lib/module-re.html
Regular Expressions module.
On 7/15/07, Sara Johnson <[EMAIL PROTECTED]> wrote:
>
Also since you're writing your found results to a file there's no need to
print the results to the screen. That should shave off some time,
especially if you have a lot of hits.
On 6/26/07, Kent Johnson <[EMAIL PROTECTED]> wrote:
Robert Hicks wrote:
> idList only has about 129 id numbers in it
I'm running Feisty as well.
I launched python in two separate consoles and tried this:
1st console
import subprocess
subprocess.call('gedit --new-window window1',shell=True)
gedit launches with a blank file called window1. The python shell is now
waiting for gedit to exit be
Nice entry at wikipedia:
http://en.wikipedia.org/wiki/Base_32
I like the naming of Base32: *duotrigesimal
*Gotta try to work that into a conversation somehow.*
*
On 6/18/07, Alan Gauld <[EMAIL PROTECTED]> wrote:
"cms cms" <[EMAIL PROTECTED]> wrote
> Newbie here trying to find a module that I
More than one way to skin a cat:
import operator
sort_key = operator.itemgetter(1)
sorted(inventory.items(),key=sort_key)[-1]
('oranges',525)
or...
inventory.items()
[('pears', 217), ('apples', 430), ('oranges', 525), ('bananas', 312)]
count_first = [(count,fruit) for fruit,count in invent
Google is your friend:
http://www.google.com/search?sourceid=navclient&ie=UTF-8&rls=GGLR,GGLR:2006-33,GGLR:en&q=python+symbian
The first link in particular looks good.
On 5/16/07, Chenthil <[EMAIL PROTECTED]> wrote:
Hi can some one show nd some good tutorials for writing scripts for
symbian
heh... forwarding to the list, too.
-- Forwarded message --
From: Jason Massey <[EMAIL PROTECTED]>
Date: May 15, 2007 6:51 AM
Subject: Re: [Tutor] Text matching
To: "Gardner, Dean" <[EMAIL PROTECTED]>
Look at it a different way. If the one thing that is s
The main thing your program lacks is flexibility. Adding new puzzles
requires chaining together a series of if..else statements and creating
variables for each hint.
Here's my quick version. I store the puzzles and the hints in a two-tuple
sequence. Following this method you could easily add a
In the interpreter this doesn't work:
f = open(r"c:\python24\image.dat")
line = f.readline()
while line:
... line = f.readline()
... f.close()
Traceback ( File "", line 3
f.close()
^
SyntaxError: invalid syntax
But this does:
f = open(r"c:\python24\image.dat")
line = f.readline()
I've tested this on my Apache server setup, it succesfully downloads the gif
file and the text file and saves them. Even though I used the 'wb' flag
(write binary) for the text file it turned out okay (the difference in 'w'
and 'wb' seemed to be that 'wb' stripped off some of my blank lines). On
You'll need a style sheet.
See: http://alistapart.com/articles/taminglists/
On 3/14/07, Kirk Bailey <[EMAIL PROTECTED]> wrote:
It just occurred to me that when my wiki does a backsearch it is useful
to list the results with a * for decorating the unordered list results,
so I can mousecopy it t
I found a similar discussion on the pysqlite mailing list (
http://lists.initd.org/pipermail/pysqlite/2005-August/000127.html)
Try committing your changes and then closing your cursor.
db.commit()
cur.close()
db.close()
On 3/13/07, Jim Roush <[EMAIL PROTECTED]> wrote:
I'm geting the followin
When you call sys.exit() you're raising a SystemExit exception.
help(sys.exit)
Help on built-in function exit in module sys:
exit(...)
exit([status])
Exit the interpreter by raising SystemExit(status).
If the status is omitted or None, it defaults to zero (i.e., success).
If the s
Oh, the irony...googling for python and gwt gave me:
http://pyjamas.pyworks.org/
On 2/16/07, Shadab Sayani <[EMAIL PROTECTED]> wrote:
Hi ,
We have a project where I need to read files store
them in database in the backend.We have done this in
python.Now we decided to use Ajax technique for u
The simplest way would be to use TkInter which is distributed with Python.
Check out the cookbook recipe at:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/438123 for a bunch
of examples.
jason
On 1/5/07, Mike Ellis <[EMAIL PROTECTED]> wrote:
Hi all,
I am looking to create a simple
An example of your code would help. According to the cx_oracle docs at
http://www.python.net/crew/atuining/cx_Oracle/html/index.html under the LOB
Objects heading:
6. LOB Objects
*NOTE*: This object is an extension the DB API. It is returned whenever
Oracle CLOB, BLOB and BFILE columns are fetch
If you mean which type of GUI model to use you have at least two popular
choices.
Tkinter: It's bundled with Python, and there's a tutorial at:
http://www.pythonware.com/library/tkinter/introduction/
wxPython: My GUI of choice. http://wxpython.org
A quick and dirty example in wxPython of what y
I'm running WinXP and the entire text is selected when you enter a new
choice. In fact, on XP at least, you don't have to use SelectAll, SetFocus
selected the entire text.
On 11/30/06, Jia Lu <[EMAIL PROTECTED]> wrote:
Hi all
I am using wx Py with FC6. I ran the program below but I found th
So you want to convert a list into a tuple.
Here ya go, using your example of the table setup:
raw_table ="""
%s | %s | %s
--
%s | %s | %s
--
%s | %s | %s
"""
from random import choice
x_o = [choice(['x','o']) for i in range(9)]
x_o
['x', 'x', 'x', 'x', 'o', 'o', 'o',
Check to make sure that under the shortcut properties that you have the
"Start in" field filled out with the directory the script is located.
On 11/17/06, Chris Hengge <[EMAIL PROTECTED]> wrote:
Whether using py2exe or pyInstaller I've noticed a problem and I'm not
sure how to fix it...
When I
How about two different ways:
import datetime
t = datetime.datetime.now()
t
datetime.datetime(2006, 11, 16, 11, 28, 15, 75)
t.hour
11
t.minute
28
t.second
15
a = "%d:%d:%d" % (t.hour,t.minute,t.second)
a
'11:28:15'
or, a bit more succinctly:
t.strftime('%H:%M:%S')
'11:28:15'
How about something like:>>> data = "" 0, 'title': 'Linux'}, {'id': 1, 'title': 'FreeBSD'})>>> id = 0>>> result = [x for x in data if x['id'] == id][{'id': 0, 'title': 'Linux'}]
>>> result = [x for x in data if x['id'] == id]>>> result[0]{'id': 0, 'title': 'Linux'}>>> You get the entire dict entry
Shawn,Python already has a module called site. From http://docs.python.org/lib/module-site.html :This module is automatically imported during initialization.
The automatic import can be suppressed using the interpreter's
-S option.
Importing this module will append site-specific paths to the mo
More specifically, Joe, where and what types of errors are you getting?When I type in your example exactly as above I get the following:>>>from decimal
import *>>> Decimal('7.').quantize(Decimal('1.000'),rounding=decimal.ROUND_DOWN)Traceback (most recent call last): File "", line 1, in ?NameE
e 17, in ?
from matplotlib._ns_nxutils import *ImportError: numpy.core.multiarray failed to import
On 10/23/06, Jason Massey <
[EMAIL PROTECTED]> wrote:
Very possible:For gnuplot:
http://gnuplot-py.sourceforge.net/ See the instructions for using on Windows.For Matplotlib:
http://
Very possible:For gnuplot:http://gnuplot-py.sourceforge.net/ See the instructions for using on Windows.For Matplotlib:
http://matplotlib.sourceforge.net/installing.htmlPossibly what's confusing you is that both versions have external dependencies such as Numpy and Numeric (are those the same? I'l
ll that replace the location? or add to it? Thanks.On 10/20/06, Jason Massey <
[EMAIL PROTECTED]
> wrote:Why not:if item in list: loc = list.index(item)
list[loc] = strOn 10/20/06, Chris Hengge <
[EMAIL PROTECTED]> wrote:
I'm trying to build a little piece of code that repla
Why not:if item in list: loc = list.index(item) list[loc] = strOn 10/20/06, Chris Hengge <
[EMAIL PROTECTED]> wrote:I'm trying to build a little piece of code that replaces an item in a list.
Here is a sample of what I'd like to do.str = "This was replaced"ff item in list: replace item with str
It should look like this:fout = file('/home/cable/sandbox/%s' % savename, 'a''w')The variables come immediately after the string your formatting.On 10/19/06,
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
I am stumped. I am trying to pass the variable 'savename' to a stringand get errors.can someon
On 10/12/06, johnf <[EMAIL PROTECTED]> wrote:
On Thursday 12 October 2006 00:31, Alan Gauld wrote:> > query = "SELECT * FROM DB WHERE NAME = %s" % (name)> > cursor.execute(query)>> There can be security issues with this style, especially
> if the parameters can be modified by users - for example> y
I found this on an artima forum:http://www.artima.com/forums/flat.jsp?forum=181&thread=113874
This worked on my machine (win xp):socket.getaddrinfo(socket.gethostname(), None)[0][4][0]On 8/10/06, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:hello list
is there in python an independent from the syst
I came across this at: http://www.monkeyhouse.eclipse.co.uk/amiga/python/For more powerful operation under AmigaDOS, and
because it is needed for the ARexx implementation, there are two
additional modules. The first is the low-level builtin module Doslib,
and the other, the Dos module, is written o
Googling for modbus python turned up:https://lintouch.org/repos/lintouch/lsp-modbus/trunk/tests/
On 7/5/06, Jeff Peery <[EMAIL PROTECTED]> wrote:
Hello, I need to talk read write to a modbus so that I can work with a PLC. I have not a clue how this all works. does python have a modbus module or whe
How about:elif ch_val in ['040','011','012']:On 6/14/06, Andrew Robert <[EMAIL PROTECTED]
> wrote:-BEGIN PGP SIGNED MESSAGE-Hash: SHA1Hi Everyone,
In the middle of an if then else, I have the following lineelif ch_val == '040' or ch_val == '011' or ch_val == '012':The line works but
David,What answer did you get? One of the things to rember on the challenge is to take your answer and put ".html" (no qutoes) on the end of it in the url.So for the first problem the url would be:
http://www.pythonchallenge.com/pc/def/.htmlOn 5/4/06, David Holland <
[EMAIL PROTECTED]> wrote:
I lo
How about:import syssys.exit()On 5/3/06, Matthew Webber <[EMAIL PROTECTED]
> wrote:This has got to be trivial, but I can't find the answer ... I want to stop
execution of my main script half way through. This is just for debugging -the code in the bottom half of the script generates a whole lot of
John,Basically it's not evaluating it the way you think it is:Your first example really equates to:if (1 or 5) in rollList: etc...(1 or 5) equals 1 and 1 isn't in the your list.
On 4/26/06, John Connors <[EMAIL PROTECTED]> wrote:
G'day,I found something today that has me confused. I'm making a l
Works for me:>>> dict1 = { 0x2018:u'k', 0x2019:u'd'}>>> n = 0x2018>>> print dict1[n]k>>> On 4/11/06,
kakada <[EMAIL PROTECTED]> wrote:
Hello all,For example, I have a dictionary:dict1 = { 0x2018:u'k', 0x2019:u'd'}I assign:n = 0x2018print dict1[n]Then:KeyError: '0x2018'But I can call directly:print
The problem here is that you need to reference the factor30 namespace to get to your functions:
Your calls to your functions would then look like:
factor30.factor(109)
&
factor30.factor0(109)
If you don't want to have to put the factor30 in front of all your function names you can do t
How about:
>>> [pow(2,x) for x in [1,2,3,4]]
[2, 4, 8, 16]
On 2/14/06, Michael Broe <[EMAIL PROTECTED]> wrote:
I read somewhere that the function 'map' might one day be deprecatedin favor of list comprehensions.But I can't see a way to do this in a list comprehension: >>> map (pow, [2, 2, 2, 2],
Andrew,
I put in your code, exactly as you have it, with only three changes:
#!/usr/bin/python
import os
for (dirpath, subdirs, filenames) in os.walk("/python24"): # a comma instead of a period after dirpath
for file in filenames:
if
file.endswith(".py"):
Christopher,
I copied and pasted your code and it worked only a few
modifications. The thing I had to change was the indention level
of the:
def __and__(self, other): return self.intersect(other)
def __or__(self, other): return self.union(other)
def __repr__(self): return 'Set:' + list.__repr__(
ECTED]> wrote:
On Tue, 3 Jan 2006, Jason Massey wrote:> I've just finished ripping out a bunch of lines in one of my wxPython> programs. Testing it out I get:>> C:\Python24>tla2.py> File "C:\Python24\tla2.py", line 412
> self.grid.SetCellValue(0,0,&
I've just finished ripping out a bunch of lines in one of my wxPython programs. Testing it out I get:
C:\Python24>tla2.py
File "C:\Python24\tla2.py", line 412
self.grid.SetCellValue(0,0,"Site")
^
SyntaxError: invalid syntax
There's nothing wrong with that line. I didn't even touch it
googled for rsa & python:
http://www.python.org/workshops/1995-05/pct.html
On 1/3/06, lfiedor <[EMAIL PROTECTED]> wrote:
Hiim looking for very simple DES and RSA algorithms writen in python (orC), can anyone know where i can find them___Tutor maillist
Nathan,
Look here:
http://effbot.org/tkinterbook/entry.htm
Apparently you can change the default setting for the entry box so that
it will show whatever character you like rather than what the user is
typing.
On 11/29/05, Nathan Pinno <[EMAIL PROTECTED]> wrote:
Hey Danny and all,Alberto told me
Boyan,
A listing of all the built-in exceptions can be found at:
http://docs.python.org/lib/module-exceptions.html
And is this what you're looking for?
>>> a='123'
>>> int(a)
123
>>>
A description of this, and the other built-in functions, is at:
http://docs.python.org/lib/built-in-funcs.ht
I've got a problem with scope that I can't say I've ever encountered.
The comments explain the situation pretty well.
import player
class Game:
def __init__(self,screen):
self.market = Market.Market()
self.countries = pickle.load(open("sup.coords",'r'))
lol,
that's just funny.
On 11/10/05, Shi Mu <[EMAIL PROTECTED]> wrote:
> the Internet is down for one day and so wonderful to have so many
> responses. i have checked all the links you guys mentioned. what i
> want is delaunay triangulation and the available ones online are
> written in C, Java
All you need is the line continuation character, '\':
if (condition 123 and \
condition 456) :
On 10/27/05, CPIM Ronin <[EMAIL PROTECTED]> wrote:
> When using IDLE, after hitting F5 to save and run, if an error occurs, it
> merely flashes at the code location of the error. While I usually figu
well that would definitely cause your error.
The string.split sends the list to a, but after that it's looking for
something to assign to l and there's nothing leftover from the command
for it to assign.
On 10/18/05, Randy Bush <[EMAIL PROTECTED]> wrote:
> > >>> l = []
> > >>>a='1|2|3|4'
> > >>>
Works fine for me:
>>> l = []
>>>a='1|2|3|4'
>>> l=a.split('|')
>>>l
['1', '2', '3', '4']
On 10/18/05, Randy Bush <[EMAIL PROTECTED]> wrote:
> and stupid question of the morning (for me)
>
> i want to string.split() into a sequence, a la
>
> l = []
> l = myString.split('|')
>
> but, of cours
More than anything, I think clearer variable names will help here.
Something like:
def main():
... speed_limit = 60
... clocked = int(raw_input("Clocked speed:"))
... miles_over = clocked - speed_limit
... fine = 50 + 5 * miles_over
... if miles_over >= 30:
... pri
58 matches
Mail list logo