Things you need to know. In order
* HTML
* Javascript
* CGI Webscripting, this teaches you the difference between GET and POST,
with this you can make simple things, like a page view counter for example,
or a simple game of hangman.
* Web framework or Templating language, python is not we
One way to work around this and still use SQLight is to put the database on
a shared drive. SQLight does table locking, or is it file locking. Anyways
conflicts will be very minimal to non-existant with only two clients as most
operations will complete in microseconds. The SQLight website even s
One way to work around this and still use SQLight is to put the database on
a shared drive. SQLight does table locking, or is it file locking. Anyways
conflicts will be very minimal to non-existant with only two clients as most
operations will complete in microseconds. The SQLight website even s
Oh, I forgot there's another way to add braces
if it_is_way_cool: #{
print 'coolness'
#}
On Wed, Aug 13, 2008 at 11:06 PM, xbmuncher <[EMAIL PROTECTED]> wrote:
> I'll check out your links. But in response to some of the things said:
> I'm a fan of indentation, a replacement of indentation with
Well I would imagine that many of the programmers here use emacs or
vim. I use vim, however I've used komodo for python and I liked it a
lot.
However if you are going to program a great deal (I don't' know what
your intentions are) then I recomend taking the 20-40 hour it takes to
learn emacs or
Actually the way this list works is there is no one person who will do
this. However if you pose a specific question I'm sure you will get
several helpful people will respond. Like this.
What book did you read and what topics did it cover? From there
someone perhaps even myself will be able to
This is a great suggestion. I too learned how to do threading in
python from reading code. For me I read the btdownloadheadless.py
code. Which comes as part of the standard bittorrent client in linux.
On Thu, Jul 31, 2008 at 7:11 AM, Monika Jisswel
<[EMAIL PROTECTED]> wrote:
>> I'm looking for
What I use in this situation is the INI config file parser in the
standard lib. It's easy to use
##CONFIG FILE
[paths]
images=/home/user/Images
##CODE###
import ConfigParser
config=ConfigParser.ConfigParser()
config.readfp(open(conf,'r'))
print config
http://docs.python.org/lib/module-Con
Well I can confirm this behavior. I tried changing the user-agent
thinking there might be some filtering based on that but no go. Still
HTTP 400 error. WGET works just fine though
On Fri, Jul 18, 2008 at 4:31 PM, asdg asdg <[EMAIL PROTECTED]> wrote:
> I'll skip the introduction and go right to t
On 10/19/06, Chris Hengge <[EMAIL PROTECTED]> wrote:
I'd personally do something like this. file = open(myfile, 'r')fileContents = file.readlines() # read the entire document into memory for speed.file.close()print fileContents[-1] # This is the last line.
This works as wellfile('filename.txt').rea
While everything that Alan Guald said is true, there are a couple of
options for you. Provided you know HTML (you must), you could
generate html pragmatically but, knowledge of html is still mandatory.
Your options are, basically
http://www.cherrypy.org
Which is an app server that should be fair
I think isinstance() is probably the best way to do this. I however
always do type(x)==TestType:
where TestType is a string that is returned from type() or not what
ever the case.
On 5/8/06, Emanuele Rocca <[EMAIL PROTECTED]> wrote:
> Hello list,
> I've got a question partially related to this t
Are you just trying to make a continuation?
On 5/3/06, Igor <[EMAIL PROTECTED]> wrote:
> Hi.
>
> And I thought I understood python pretty well. Until I got hit by this:
>
> >>> def f(x):
> ... print x
>
> >>> cb = [lambda :f(what) for what in "1234"]
> >>> for c in cb:c()
> 4
> 4
> 4
> 4
>
> And
I have learend a great deal of python, and I have never bought a book.
All the information one really needs is available freely on the
internet.
As long as you understand the basic data types you should be able to
piece together what you need from the internet.
___
Reed L. O'Brien wrote:
>I ma trying to write a script to search adn replace a sizable chink
of
>text in about 460 html pages.
>It is an old form that usesa search engine no linger availabe.
>
Well in the vein of Kents suggestion there is
http://www.crummy.com/software/BeautifulSoup/ however it wi
Well when working with M$ db's you should use odbc.
http://www.egenix.com/files/python/mxODBC.html
nephish wrote:
>Hey there,
>
>i have used the cgi module and dig it.
>heres the deal,
>my employer wants me to build a dynamic website that will access
a
>database and display customer
Asif Iqbal wrote:
>On Fri, Jun 17, 2005 at 07:41:17AM, Chad Crabtree wrote:
>
>
>>How about this.
>> >>> from random import choice
>> >>> alist=[choice(range(100)) for x in range(1000)] #just making a
>>
>>
>
>How do I do this i
How about this.
>>> from random import choice
>>> alist=[choice(range(100)) for x in range(1000)] #just making a
list
to look at pretend this is a file
>>>
>>> counter={}
>>> for item in alist:
... if item in counter.keys():
... counter[item]+=1
... else:
... counter[i
Kent Johnson wrote:
>Olli Rajala wrote:
>
>
>>Hi again,
>>
>>I have a '2D array', I mean a list inside a list ([[][],[][],...])
and
>>would need to check if the value exists in it. Of course I could do
a
>>for loop, but that just seem to be a little overkill, so is there
any
>>other way to do it
The symptoms you explain mean you don't have py2exe installed
correctly. Try uninstalling it and reinstalling it.
Joseph Quigley wrote:
> Joseph Q. (Uspantan, Guatemala) Using Python 2.4
>
> I downloaded py2exe and can't get it to make exe's of my python
files.
> There are a list of instructi
I'm at a loss as to why this is helpful. How and why would one use
this
instead of a regular list? I know what linked lists are and why they
would be useful in C++ or C or any other but not python.
Orri Ganel wrote:
>Hello all,
>
>
>
>I've been working on making a complete pythonic LinkedList
Alan Gauld wrote:
>ie No lambda used at all.
>
>I wish Python had real lambdas!
>
>
If python had real lambda's then it would be lisp or schema.
__
Do you Yahoo!?
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.co
Jacob S. wrote:
>> aFuncList=[]
>> def x():
>>print "one"
>> aFuncList.append(x)
>> def x():
>>print "two"
>> aFuncList.append(x)
>> def x():
>>print "three"
>> aFuncList.append(x)
>> for item in aFuncList:
>>item()
>
>
> Okay, for this problem (it can be altered otherwise)
>
> def
Max Noel wrote:
>
> According to the Jargon file, this one is called Whitesmiths
> style. I tend to use Allman style myself, but given the code
> completion, spellchecking, etc. in modern IDEs, I suspect it's
become
> more a question of personal preference than anything else.
>
> A bit
Thank you all for answering my question. I thought it would be some
misunderstanding on my part. The example Andrei made was very
telling.
Andrei wrote:
s = "d:/tests/test.txt"
class dummyfile(object):
>... def open(self, *args):
>... print "dummyfile.open
I've tried this and I cannot figure out why this does not work. I
figure this has something to do with order of operations. I figured
someone would know exactly why it doesn't work. Wouldn't this start
inside parens then from left to right?
open(item,'w').write(open(item,'r').read().replace(
How about a concrete example where lambda is more elegant than a
named
block of code
aList=['a','bb','ccc','','ee']
bList=aList[:] #deep copy
assert not bList is aList
def sortByLength(item1,item2):
return cmp(len(item1),len(item2))
bList.sort(sortByLength)
assert bList==['a', 'bb', 'ee
Well in the same vein as what the others put out there I made a
verbose
'ls *.ext' so that you can see how to do it in one go. I figured
this
would give you enough of an example. You can hard code these things
into your program. I used a construct similar to this to create an
instant html ph
I'm going to look more in to import hooks. I am only looking for
syntactic sugar, at least at this point. It's not really my ambition
to
make more efficient code.
To Ryan. I looked at COG before (not in this case but general
looking
at python packages) it doesn't really do what I was thinki
Well I don't think that it would really require that. I could just
define macro's in a module and just do it like so
import macro
import defined_macros as m
macro.expand(m.with(),m.assert())
I just thought it would be best to have definitions at the head of a
script, or at least to have the o
Try a simple bubble sort. This will not have great performance on
big
files at a worst case scenario it will take n-1 loops to sort. This
is
not very general and would require a substantially different
implementation.
def bublesort(l1,l2,l3):
modified=True
while modified:
modif
Ok I'll explain what I've done so far. I'm using tokenize to take
the
file that imports macro; found by using stack inspection and then
tokenize it. I look at all the string tokens to see if they match
they
pattern a macro should have. Then I pass the macro string through
the
tokenizer agai
I'm trying to make a macro system that's work by just doing this
import macro
class withMacro(prefixMacro):
pass
mac=withMacro()
mac.pattern("item key")
macro.expand()
g=[]
"""
with g:
.append('a')
.append('b')
.append(123)
"""
I would like to not have to use the comment strings
Does anyone happen to know how to turn of the syntax checking in
python? I've been working on a module driven preprocessor but I'd
like
to not have to use comment strings.
__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection
Ok you got me thinking. I used the same thing I posted before but
created a one liner that as a side affect makes adict like before.
[adict.__setitem__(x,adict.get(x,0)+1) for x in l]
I think it's kinda funny and ugly, ohh and not particuarly clear
about
what it does.
Wolfram Kraus wrote:
> g
Ok. I think I understand and I happen to be up at 1:30 my time so
here
is the solution as I understand the problem. This is a very common
problem and has a fairly easy solution. You can then take
adict.keys()
which returns a list of unique elements. Good Luck
import random
l=[random.randra
Try the os module. I think this should probably get you there.
http://docs.python.org/lib/module-os.html
Miles Stevenson wrote:
>I would like to search filesystem structures using globs on Posix
systems from
>within Python. I don't see an obvious method to do this with in the
standard
>modules
I too once had trouble remembering (and finding) the name of this
library so here it is.
http://www.tizmoi.net/watsup/intro.html
I have not used it but the documentation by example, seemed to me to
be
approachable.
Tony Meyer wrote:
>There's a Python library for controlling Windows in this sort
I got this from spyce
http://spyce.sourceforge.net
_url_ch = re.compile(r'[^A-Za-z0-9_.!~*()-]') # RFC 2396 section 2.3
def url_encode(o, **kwargs):
'''Return URL-encoded string.'''
return _url_ch.sub(lambda match: "%%%02X" % ord(match.group(0)),
str(o))
It was just the first thing I found in
Kevin wrote:
>Thanks for the advise. I am no ware near ready to do this as i am
just
>
>learning to use python. I just thought it would be interesting to
see
>
>a mud made in python rather then always in C or C++. So for now I am
>
>only going to start out making small programs to learn with. So
t
I was thinking (it's been a while since I played) that I would do it
like this. (strawman code)
class Character:
def __init__(self,name,attribs,skills,cyberware):
...initialize..
and code to check attrib and skill mins and maxes
physical and menatl attributes should be part
I can't really think of a more elegant solution than what you have,
maybe regex's but I hate those. You *can* reduce the number of lines
by
two, and there was a variable you never used.
HTH
Eric L. Howard wrote:
>The following block of code works, and provides the necessary output
I'm
>looking
Jack Cruzan wrote:
>class Character:
>
> def __init__(self, name = ' ', race = 'Human', magic = 'None'):
>
> self.name=name
>
> self.race=race
>
> self.magic=magic
>
>
I know your going to need some other stuff.
class NewCharacter(Character):
Right what he said. I'm sorry I didn't make that clear. This way
py2exe can look and see import Tix and see it's needed. Py2exe does
not
ship the whole python distribution, rather only what is needed.
Indeed
it tends to ship many things that are not needed but it's better than
the whole dis
Try something like.
import mx
import Tix
Sometimes py2exe will not gather up all the modules that it depends
on.
It does an admirable job but still needs some help. Perhaps you are
in
advertently using mx? Well try that and see what happens.
Guillermo Fernandez Castellanos wrote:
>Hi,
>
>
Danny Yoo wrote:
>Using the default parameter 'n' in the readline() method isn't safe:
all
>class instances will end up using the same 'n'. You may want to put
the
>current line number as part of an instance's state, since two
instances of
>a macroString should be able to keep track of their line
Thank you KentBot. That was what I wanted.
Kent Johnson wrote:
> Best: use the StringIO or cStringIO module instead, this is exactly
> what it is for. If you really need len() you could maybe subclass
> StringIO to do what you want.
>
> Next best: Use an iterator. Something like this (Warning!
rted module you
could
> probably figure out who is importing you.
>
> Do you really want the module where the import was done (the place
> where the import statement is)? Or are you trying to find the file
> containing the imported module?
>
> Kent
>
> Isr Gish wrote:
>
&g
I have created a file-like object out of a triple quoted string. I
was
wondering if there is a better way to implement readline than what I
have below? It just doesn't seem like a very good way to do this.
class _macroString(object):
def __init__(self,s):
self.macro=s
self.l
Is there a way to know what the path of the file is that imported a
module? I've tried __file__ and playing with globals() but I can't
seem
to crack this.
__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://ma
You should post this on the Python Cookbook
http://aspn.activestate.com/ASPN/Python/Cookbook/
Orri Ganel wrote
> Bill Kranec wrote:
>
>
>
>> Hello,
>
>
>>
>
>> I have a list of lists, for example [ [1,2] , [3,4] ], and I would
>
>
>> like to pass all the elements of that list as arguments to a
f
The only problem with this if it is to big or to deeply nested then
it
will overflow the stack?
Mario Rol wrote:
> nice and concise, found on comp.lang.python:
>
> def flatten(a):
>if not isinstance(a,(tuple,list)): return [a]
>if len(a)==0: return []
>return flatten(a[0])+flatten(a[
I just wanted to let everyone know a detail about Jython. It is not
in
fact an interpreter written in Java it is a dynamic Python to
JavaByteCode compiler.
At least that's how I understand this document.
http://www.jython.org/applets/issues.html
I found this interesting and I thought you all
Ismael Garrido wrote:
> [EMAIL PROTECTED] wrote:
>
>> Quoting Ismael Garrido <[EMAIL PROTECTED]>:
>>
>>
>>
>>> I am trying to make a program that will plot functions. For that,
I
>>> need
>>> to be able to get an input (the function to be plotted) and
execute it.
>>>
> >
> >
> >So you want the
Jacob S. wrote:
>## Spoken by Ara ##
>Pardon to the non-german speaking (or readers) on the list.
>
>Guten Tag. Mein Deutsch ist nicht so gut (ich habe keinen Deutsche
in sieben
>
>
Good Day. My German is not so good (I have writen very little german
in
seven years)
>Jahren geschreiben). Mann
aint=1077
list_of_aint_as_string=list(str(1077))
print list_of_aint_as_string #['1', '0', '7', '7']
#turn it into a list of integers
#doc for map() found on
http://docs.python.org/lib/built-in-funcs.html
list_of_aint_as_integer=map(int,list_of_aint_as_string)
print list_of_aint_as_integer #[1, 0, 7
I think it's a great idea, I would like to participate also.
Brian van den Broek wrote:
> Jacob S. said unto the world upon 2004-12-18 21:06:
>
>> I probably wouldn't be any help on projects, but I would probably
learn
>> stuff from it.
>> I'm okay with it.
>> Jacob Schmidt
>>
>>
> I just got
Asif Iqbal wrote:
>Hi All
>
>Has anyone done any script like this? Use a python script for
Windows XP
>that will continuosly check if my USB is plugged in. So if I unplug
my
>USB flashdrive it will fork a screensaver with password lock.
>
>Thanks for any idea/suggestion
>
>
>
You could make scre
Olli Rajala wrote:
>
>
>
>>Ok. I tried running the script on my Apache server on Windows NT
and IT
>>WORKS The script saves the values of videodb keys correctly.
DARN!!!
>>I don't get it. Why does the exact same script work on Win and not
on Linux.
>>
>>Oh, did I mention I am developing the
Bob Gailer wrote:
> For grins I just wrote one that takes '1 2.3 - 3 4 5 + * /' as
input
> and prints -0.0481481 8 lines of Python. That indeed is less
than
> 100. Took about 7 minutes to code and test.
I'm quite interested in seeing the sourcecode for that.
__
60 matches
Mail list logo