1. whats the best way to round a result to 4 decimal places?
I tried round, but then read that it only works with exponents of 10.
I'm trying to do it on this piece of code.
time = (distance / 4900)
2. What direction would I go in if I'm getting 5 inputs from the user
and want to make a bar t
e worked from Gmail.
I usually use Perl for data stuff like this, but I don't see why
Python wouldn't be a great solution. However, I would re-write it
using regexes, to seek and replace sections that are formatted like a
date, rather than breaking it into a variable for each field, changing
each date individually, then putting them back together.
As for how MySQL likes having dates formatted in CSV input: I can't
help there, but I'm sure someone else can.
I'm pretty new to Python myself, but if you'd like help with a
Perl/regex solution, I'm up for it. For that matter, whipping up a
Python/regex solution would probably be good for me. Let me know.
Shawn
--
http://mail.python.org/mailman/listinfo/python-list
To the list:
I have come up with something that's working fine. However, I'm fairly
new to Python, so I'd really appreciate any suggestions on how this
can be made more Pythonic.
Thanks,
Shawn
Okay, here's what I have come up with:
#! /usr/bin/python
import sys
impo
t the
documentation. This won't be the creation of a brand-new distro --
it's the same thing as changing the wallpaper and creating your custom
re-master just for yourself.
Both distros I mentioned (and many others, I'm sure) have a simple,
built-in tool for installing additional pack
On 8 Feb 2007 08:28:25 -0800, Johny <[EMAIL PROTECTED]> wrote:
> Playing a little more with strings, I found out that string.find
> function provides the position of
> the first occurance of the substring in the string.
> Is there a way how to find out all substring's position ?
> To explain more,
On 2/8/07, Gary Herron <[EMAIL PROTECTED]> wrote:
> Johny wrote:
> > Playing a little more with strings, I found out that string.find
> > function provides the position of
> > the first occurance of the substring in the string.
> > Is there a way how to find out all substring's position ?
> > To ex
On 8 Feb 2007 09:05:51 -0800, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
> On 8 feb, 12:41, "Shawn Milo" <[EMAIL PROTECTED]> wrote:
>
> > I have come up with something that's working fine. However, I'm fairly
> > new to Python, so I'd really
On 2/8/07, Jussi Salmela <[EMAIL PROTECTED]> wrote:
> Shawn Milo kirjoitti:
> > To the list:
> >
> > I have come up with something that's working fine. However, I'm fairly
> > new to Python, so I'd really appreciate any suggestions on how th
t ... insulted
>
> hg
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
I'm surprised you all didn't just tell him how to become a hacker.
That's what he wants, right?
Here's the hacker info. Enjoy!
http://www.catb.org/~esr/faqs/hacker-howto.html
Shawn
--
http://mail.python.org/mailman/listinfo/python-list
On 2/10/07, Tina I <[EMAIL PROTECTED]> wrote:
> zefciu wrote:
> > enes naci wrote:
> >> i would like to know about hacking in python too whether its illegal or
> >> not is not the point and anyway it doesn't mean i'm gong to use it.
> >>
> >
> > If you mean hacking as modyfying the code of interpre
ral. Grep, Perl one-liners, Python, and other tools use
regexes, and you'll find that they are really clever little creatures
once you befriend a few of them.
Shawn
--
http://mail.python.org/mailman/listinfo/python-list
eploy for large user groups.
>
> I'm not aware of any free tools for building MSIs, but I'd love to find
> one.
I just learned about this one within the last week, wix
http://wix.sourceforge.net/
PHP.net uses it for their Windows installers.
-Shawn
>
> - Adam
>
>> ---
However, the python is not poisonous, so it is also edible if you can kill
one before it squeezes you to death. Despite this fact, it is not a major
food source for group members, due to our great respect for the mighty
python.
Shawn
On Nov 16, 2007 9:14 AM, Thorsten Kampe <[EMAIL PROTEC
On Nov 16, 2007 2:16 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> On Nov 16, 8:14 am, Thorsten Kampe <[EMAIL PROTECTED]> wrote:
> > * Cope (Fri, 16 Nov 2007 06:09:31 -0800 (PST))
> >
> > > please tell me what is python.This group is so crowded.
> >
> > A Python is dangerous snake[1]. This gr
I completely support Wildemar. Lazy questions like that deserve absolutely
nothing.
I agree that cushioning the reply with a brief explanation of why that
question sucks would have helped the original poster, but he doesn't deserve
any effort from any of us until he has shown evidence of his own e
I'm just trying to test and see if the get mouse statements are working
in my program. If they are, in the console window, it should go back to
the prompt. It doesn't for all of them, just the last
rectangle...sometimes. Am I setting them up correctly? here's the
relevant code...thx
The f
For my final project, I'm trying to do a GUI based game similar to are
you smarter then a 5th grader. I've been working on it and am stuck
with some code someone helped me with to randomize the A,B,C,D letters
that the correct answer is assigned too. The code that does this is
highlighted in
Sorry, 4got to send it in html for the bold parts.
thx
def drawMainMenu(win):
#define and draw the buttons
mainMenuList = []
mainMenuList.append (CreateRect(4,6,7,8,"grey",win))
mainMenuList.append (CreateRect(3.5,6.5,5,6,"grey",win))
mainMenuList.append (CreateRect(3.5,6.5,3,4,"g
included in
the error msg.
#adds player's score to high score list if high enough
if(hasHighScore(wins) == True):
setHighScores(wins,getName(wins))
And this is what the text file looks like when it happens.
High Score Name
-
15
>for i in range(0,len(scores)):
>outfile.write("\t" + str(scores[i]) + "\t\t\t" + names[i] + "\n")
>outfile.close()
>
> And here's the call to the functions at the end of my game, included
> in the error msg.
>
>#ad
Is there a way to keep track of the number of times someone clicks on a
menu item in a prorgam? What I want to do is make the rectangle
disappear after they click on it at the main menu 3 times so visually
show them they can't do it any longer.
>
> Since I appended the button to a main menu lis
Is there a way to keep track of the number of times someone clicks on a
menu item in a prorgam? What I want to do is make the rectangle
disappear after they click on it at the main menu 3 times so visually
show them they can't do it any longer.
Since I appended the button to a main menu list,
Hi All -
Thanks to everyone for their input. The repsonses provided are exactly
what I was looking for!
Regards -
Shawn
--
http://mail.python.org/mailman/listinfo/python-list
one:
http://norvig.com/sudoku.html
I'm not making any judgements here, though. If anyone takes the time
to actually review them, I'd be interested in hearing any educated
comparisons.
Shawn
--
http://mail.python.org/mailman/listinfo/python-list
this capability? Also, is wxPython
supported?
Or are you just knowledgeable about the S60?
Thanks,
Shawn
--
http://mail.python.org/mailman/listinfo/python-list
7;re on Windows, you
can get the Windows version of fgrep here:
http://unxutils.sourceforge.net/
Shawn
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, Feb 1, 2009 at 1:14 AM, John Machin wrote:
> On Feb 1, 3:39 pm, Shawn Milochik wrote:
>
>> Not to discourage the use of Python, but it seems that fgrep with the
>> -f flag already does exactly what you want. If you're on Windows, you
>> can get the Window
>
> Book recommendation: _Mastering Regular Expressions_, Jeffrey Friedl
> --
> Aahz ([email protected]) <*> http://www.pythoncraft.com/
I wholeheartedly second this! The third edition is out now.
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Oct 31, 2008 at 2:14 PM, Bill McClain
<[EMAIL PROTECTED]> wrote:
> On 2008-10-31, Stef Mientki <[EMAIL PROTECTED]> wrote:
>> Well I don't know any Windows users that still use DOS-boxes ;-)
>> cheers,
>
> What do they do when they want to run a cross-platform command-line script
> with para
On Fri, Oct 31, 2008 at 8:57 PM, Lawrence D'Oliveiro
<[EMAIL PROTECTED]> wrote:
> In message <[EMAIL PROTECTED]>, Rob
> Williscroft wrote:
>
>> Read (and bookmark) this:
>>
>> http://www.python.org/doc/2.5.2/lib/re-syntax.html
>
> Funny how you never get a thank-you when you tell people to RTFM.
>
On Sat, Nov 1, 2008 at 11:15 AM, Nicola Larosa (tekNico)
<[EMAIL PROTECTED]> wrote:
> Pat <[EMAIL PROTECTED]> wrote:
>> After you learn Python, you'll come to despise Perl.
>
> Some of us came to despise Perl *before* learning Python (third to
> last paragraph):
For what it's worth, I thought I'd
permission from some users while
allowing it for others, and you can allow your users to each have
their own password. Plus, you'll be able to log which user did what.
If this wasn't helpful, please be much more specific in restating your question.
Shawn
On Mon, Nov 3, 2008 at 8:30 AM,
This is all useful and interesting stuff, but I don't think any of it
addresses the original poster's problem, which is that he has no root
access to a Linux or Unix box, and wants to get pysqlite2 working in
his home directory. I have exactly the same problem. I have tried the
"python setup.py ins
modified to create comma-delimited files, but that's
something I never use, so it does tabs.
http://milochik.com/shawn/fwconvert.zip
Usage:
fwconvert -r rulesFile fileName [-t|-f]
or
cat filename | fwconvert -r rulesFile" (-t|-f)
-t (to tab)
On Wed, Nov 5, 2008 at 11:58 AM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> On Nov 5, 9:22 pm, "Shawn Milochik" <[EMAIL PROTECTED]> wrote:
>> This is all useful and interesting stuff, but I don't think any of it
>> addresses the original poster's
>> Thanks, but either I'm missing something or you're missing something.
>> I can't do any of what you describe on the machine I want to use
>> sqlite on.
>>
>> I have downloaded the binary sqlite3 file from sqlite's Web site, and
>
> The linux binary will not work. You need the headers and the
> l
On Wed, Nov 5, 2008 at 1:55 PM, Thorsten Kampe
<[EMAIL PROTECTED]> wrote:
> * Shawn Milochik (Wed, 5 Nov 2008 12:28:46 -0500)
>> >> Thanks, but either I'm missing something or you're missing
>> >> something. I can't do any of what you descr
On Wed, Nov 5, 2008 at 8:52 PM, Kurda Yon <[EMAIL PROTECTED]> wrote:
> By the where can I find a simle tutorial about the work with the
> "sqlite" from the Python?
> --
> http://mail.python.org/mailman/listinfo/python-list
>
Once you get the connection, you can pretty much just do whatever if
you
On Thu, Nov 13, 2008 at 2:10 PM, Grant Edwards <[EMAIL PROTECTED]> wrote:
> On 2008-11-13, Mirat Can Bayrak <[EMAIL PROTECTED]> wrote:
>
>> Hi, i'll try to write a editor in python, i want it run under
>> terminal (no qt or gtk) but i dont want to use urwid or curses
>> modules.
>>
>> Can i write m
On Sat, Nov 15, 2008 at 12:19 AM, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
> On Fri, 14 Nov 2008 20:39:53 -0800, len wrote:
>
>> hi
>>
>> Have this code in my program;
>>
>> filename = 'custfile'
>> codeline = filename + ' = [\n'
>> output.write(codeline)
>>
>> record written to file
, if that's
where the spam comes from, but it penalizes the legitimate users who
don't subscribe to the mailing list.
Just for what it's worth. This is an ongoing problem (although it used
to be much worse), and it's a shame that we're going in circles.
Shawn
--
http://mail.python.org/mailman/listinfo/python-list
//shawnmilo.com/ships/
Thanks,
Shawn
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Feb 25, 2009 at 11:38 AM, Marco Mariani wrote:
>
> Yes it's in Python alright, but it's not Pythonese yet. You could try
> avoiding the getter/setter stuff, and camelCase method naming, things like
> that, for a start.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
What d
Thanks. I wasn't aware of the property() function, but I read up on
it. I modified the Vessels.py file, but not the board file (except
where necessary to handle the changes made to Vessels. Is this better?
http://shawnmilo.com/ships/ships2/
--
http://mail.python.org/mailman/listinfo/python-list
ay is anti-Pythonic.
Unless, of course, anything I said is wrong, which is always possible.
If I'm missing a bigger-picture idea, I'd like to know about it.
Thanks,
Shawn
--
http://mail.python.org/mailman/listinfo/python-list
;ve found this page to be pretty helpful:
http://www.regular-expressions.info/python.html
Shawn
--
http://mail.python.org/mailman/listinfo/python-list
Thanks for the tips, everybody.
I've cleaned it up, and learned some useful things from your comments
and the reading they led to.
http://shawnmilo.com/ships/
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, May 6, 2009 at 1:54 PM, Tim Chase wrote:
>> for windows this works:
>> (can't cut and paste from a dos box!###%*&!!!)
>
> Depending on how it was spawned, you can either right-click in the window
> and choose Mark/Paste (when marking, use to terminate the selection;
> and selections are b
On Wed, May 6, 2009 at 2:39 PM, Grant Edwards wrote:
> On 2009-05-06, Shawn Milochik wrote:
>
>> I know I'm coming to the conversation late, but here's what I do*:
>>
>> 1. Use Cygwin. (http://www.cygwin.com/)
>> 2. Use PuttyCYG (http://code.google.
On Wed, May 6, 2009 at 2:32 PM, iainemsley wrote:
> Hi,
> I'm trying to write a fairly basic text parser to split up scenes and
> acts in plays to put them into XML. I've managed to get the text split
> into the blocks of scenes and acts and returned correctly but I'm
> trying to refine this and g
> Damn! I may just go back to using Python from the command prompt
> instead of using IDLE.
>
> On second thought, IDLE is way too useful for indenting, dedenting,
> commenting and uncommenting blocks of code. Can't go back to using
> Notepad.
>
You might want to check out iPython, then -- it's
On Thu, May 7, 2009 at 2:19 PM, AllenLars wrote:
>
> I am trying to code a script that will allow me to go to ftp site and
> download files based on most recently modified file (date, time). I am
> brand new to programming. Any and all help is appreciated.
> --
I've actually written code to do
I know you've probably all seen this 50 times, but just in case:
http://xkcd.com/353/
And here's the result:
http://icanhascheezburger.com/2009/05/06/funny-pictures-behavior-20/
--
http://mail.python.org/mailman/listinfo/python-list
for simple XML processing with success. The
XML module seems to be the way to go, considering how many of its
child modules are listed on http://docs.python.org/library/.
import xml.dom.minidom as minidom
Shawn
--
http://mail.python.org/mailman/listinfo/python-list
Thanks for the review and the podcast. I ordered the book on Friday. I
look forward to playing with it. Also (assuming you're Ron Stephens),
thanks for the Python 411 podcast. It's a great resource, and I
recommend it to all list members.
Shawn
--
http://mail.python.org/mailman/listi
On Sun, May 10, 2009 at 1:04 PM, AllenLars wrote:
>
> Thanks Shawn. I went through the ftplib info and I was able to generate a
> list. I am needing to figure out parsing the list.
>
> AllenLars
Well, start by separating out the date and the file name. You'll want
the d
t;Beginning Python Visualization" (presenting data visually)
"Programming Collective Intelligence" (extracting valuable information
from public data sources, and more)
Shawn
--
http://mail.python.org/mailman/listinfo/python-list
How is the form "written in JavaScript"? Is it dynamically generated?
In any case, can you just send a POST request if you know the values required?
--
http://mail.python.org/mailman/listinfo/python-list
"
>
> All highly recommended.
>
> Best of luck on your Python journey!
>
> Regards,
> Malcolm
> --
> http://mail.python.org/mailman/listinfo/python-list
>
I second the Wesley Chun recommendation wholeheartedly. Also, "Text
Processing in Python" is av
Can you be more specific? That will also help you write your
requirements, which will lead to your pseudo code and then your code.
Do you want to search for a a pre-defined string (or set of strings),
or just look for anything matching a pattern to appear in the first
file? Related question: Can t
>
> I would like to parse this file by extracting the field id, ra, dec and mjd
> for each line. It is
> not, however, certain that the width of each value of the field id, ra, dec
> or mjd is the same
> in each line. Is there a way to do this such that even if there was a line
Regular expressions
Check out the built-in string.startswith() method.
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
Here is a simple prog that I can run from the Python shell and it runs fine but
when I double click the 'filename.py' ,
it does not execute the ping statement, and seems like it is stuck at the
following output:
Fri Apr 11 12:16:09 2008
Testing 192.168.0.1
The prog is as follows:
impo
Hi
I am trying to modify a small program i found off the internet as follows... I
can get the 'tracert' to work and it gives me all the info back. However, when
i replace the tracert with 'ping', the commamd prompt shows 'testing' and the
script freezes... any suggestions as why it is doing t
I'm looping through a tab-delimited file to gather statistics on fill rates,
lengths, and uniqueness.
For the uniqueness, I made a dictionary with keys which correspond to the
field names. The values were originally lists, where I would store values
found in that field. Once I detected a duplicate
How does one "plonk" stuff from Google Groups? Specifically, how
can this be done in Gmail?
Thanks,
Shawn
--
http://mail.python.org/mailman/listinfo/python-list
My stab at it:
My stab at it:
#!/usr/bin/env python
import re
query = ' " some words" with and "withoutquotes " '
query = re.sub("\s+", " ", query)
words = []
while query.__len__():
query = query.strip()
print("Current query value: '%s'" % query)
print words
pri
put
to a file: env > cron_env.txt
Then run env in your interactive session and look for differences.
Shawn
--
http://mail.python.org/mailman/listinfo/python-list
n it,
you can have the students refine the matching rules over time, and see how
those rules effect the match rate and the processing time. On the downside,
your class will not have the joy of being taught the 'ideal solution' to this
problem at the end; if you come up with that, you'll be able to go into
business and make millions of dollars a year. ^_^
Shawn
--
http://mail.python.org/mailman/listinfo/python-list
A couple of notes:
Your code is too packed together. That makes it hard to read. Put in some
whitespace (and comments, where necessary), and put spaces around your equal
signs (x = 23 instead of x=23).
That said, here's something I threw together:
#!/usr/bin/env python
def chop_list(words, si
It sounds like you're looking for SQLAlchemy.
http://www.sqlalchemy.org/
Enjoy!
Shawn
--
http://mail.python.org/mailman/listinfo/python-list
s is a major, real-world issue that remains unsolved, and companies that do
a decent job at it make millions of dollars a year from their clients. One of
my old jobs made tens of millions a year (and growing FAST) in the medical
industry alone.
Shawn
--
http://mail.python.org/mailman/listinfo/python-list
database is, the incoming data
is going to be a problem.
Shawn--
http://mail.python.org/mailman/listinfo/python-list
You could put them in a dictionary with the key being the name, instead of a
list.
Shawn
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 4, 2010, at 5:59 PM, Nav wrote:
> On Jan 4, 4:54 pm, Chris Rebert wrote:
>> On Mon, Jan 4, 2010 at 1:32 PM, Shawn Milochik wrote:
>>> You could put them in a dictionary with the key being the name, instead of
>>> a list.
>>
>> To illust
Search Google. You'll find it all.
Search this list's archives. This kind of thing has been discussed a thousand
times.
It also wouldn't hurt to brush up on this:
http://catb.org/~esr/faqs/smart-questions.html
--
http://mail.python.org/mailman/listinfo/python-list
Have a look at Paramiko. It lets you do secure transfers easily (scp/sftp)
http://www.lag.net/paramiko/
Shawn
--
http://mail.python.org/mailman/listinfo/python-list
ot in this list. Renaming "tcl2" back
to "tcl" resolves the problem, but it still doesn't explain to me why
Python is looking in that location in the first place. Can anyone shed
some light on how Python/Tkinter initialization works?
Shawn
--
http://mail.python.org/mailman/listinfo/python-list
r SWT. Check it out.
Shawn
On Nov 18, 5:11 pm, Stef Mientki wrote:
> Wouldn't it be nice
> if each fan of some form of GUI-package,
> would post it's code (and resulting images) for generating one or two
> standard GUI-forms ?
--
http://mail.python.org/mailman/listinfo/python-list
When will Java be popular enough to replace other languages in their own
environments, the way Python has done to Java (Jython) and .NET (IronPython)?
Shawn
--
http://mail.python.org/mailman/listinfo/python-list
On Jun 26, 2009, at 12:08 PM, padfoot wrote:
Sir,
Is there any module in python to open https sites through a
proxy.I am connectyed to the net via a proxy server and i am unable to
crawl https sites.
--
http://mail.python.org/mailman/listinfo/python-list
Check out the "Scrape the Web" ser
27;s probably a good idea to get into the
habit.
This way, you can catch multiple exceptions in a tuple without
confusing the interpreter:
except ValueError, IndexError as ex:
Shawn
--
http://mail.python.org/mailman/listinfo/python-list
Write a small GUI in the easy-to-use and cross-platform wxPython module. All
this GUI needs to do is allow them to input the arguments. The code can then
import your stand-alone version of the script and execute its code, passing the
arguments in.
wxPython is just Python.
--
http://mail.python
On Oct 20, 2010, at 2:00 PM, Grant Edwards wrote:
> On 2010-10-20, Shawn Milochik wrote:
> ript and execute its code, passing the arguments in.
>
>> wxPython is just Python.
>
> No, it's not.
>
> You can't assume that any windows machine with Python in
port md5
File "/home/sgong/dev181/dist/lib/python2.5/hashlib.py", line 133, in
md5 = __get_builtin_constructor('md5')
File "/home/sgong/dev181/dist/lib/python2.5/hashlib.py", line 60, in
__get_builtin_constructor
import _md5
ImportError: No module named _md5
101 - 185 of 185 matches
Mail list logo