Re: Development tools and practices for Pythonistas

2011-04-30 Thread Shawn Milochik
For what it's worth, the Python core developers have selected Mercurial. I personally use git and love it. Most open-source people seem to use one or the other of the two. They're pretty similar in most ways. Look at the big two sites for open-source repositories -- github and bitbucket. One's

Re: Development tools and practices for Pythonistas

2011-04-29 Thread Shawn Milochik
Depends on the project, but I'd start with git the time I created the first file in my project. If you're in the habit of committing then you can easily rollback missteps. If you're in the habit of making branches you can experiment without breaking the currently-working code. -- http://mail.

Re: Unix-head needs to Windows-ize his Python script

2010-10-20 Thread Shawn Milochik
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

Re: Unix-head needs to Windows-ize his Python script

2010-10-20 Thread Shawn Milochik
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

Re: pylint -- should I just ignore it sometimes?

2010-10-19 Thread Shawn Milochik
Just to be pedantic (or maybe even helpful), the use of the comma after the exception is deprecated in favor of 'as.' So: except ValueError as ex: not: except ValueError, ex: I don't know how far back in Python versions this syntax reaches, but if yours supports it then it's probably a good id

Re: When will Python go mainstream like Java?

2010-02-22 Thread Shawn Milochik
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

Re: File transfer with python

2010-01-07 Thread Shawn Milochik
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

Re: Python books, literature etc

2010-01-06 Thread Shawn Milochik
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

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Shawn Milochik
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

Re: Newbie help- Can multiple instances with multiple names automatically created.

2010-01-04 Thread Shawn Milochik
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

Re: Simple distributed example for learning purposes?

2009-12-28 Thread Shawn Milochik
On Dec 28, 2009, at 11:28 AM, Lie Ryan wrote: > > I agree fuzzy searches is indispensable in certain cases, but from the way > you're describing the issue, it appears that half of your "unsolved" problems > comes due to the poor design of the database. I agree, that the other halves > (e.g. ty

Re: Simple distributed example for learning purposes?

2009-12-28 Thread Shawn Milochik
On Dec 27, 2009, at 1:23 PM, Lie Ryan wrote: > > IMHO, that's a poor example. Rather than writing a fuzzy search algorithm, > it's easier to write a normalizer before entering data to the index (or > before comparing the search string with the corpus' string). > -- > It does seem like that a

Re: DB Table Processor?

2009-12-27 Thread Shawn Milochik
It sounds like you're looking for SQLAlchemy. http://www.sqlalchemy.org/ Enjoy! Shawn -- http://mail.python.org/mailman/listinfo/python-list

Re: How to iterate the input over a particular size?

2009-12-27 Thread Shawn Milochik
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

Re: Simple distributed example for learning purposes?

2009-12-27 Thread Shawn Milochik
The special features of the Shrek DVD showed how the rendering took so much processing power that everyone's workstation was used overnight as a rendering farm. Some kind of video rendering would make a great example. However, it might be a lot of overhead for you to set up, unless you can find

Re: handling https sites

2009-06-26 Thread Shawn Milochik
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

Re: Your Favorite Python Book

2009-05-11 Thread Shawn Milochik
On Mon, May 11, 2009 at 5:52 PM, wrote: > Sam, > > In no specific order (I brought them all): > > Wesley Chun's "Core Python Programming" > David Mertz's "Text Processing in Python" (older, but excellent) > Mark Lutz's "Learning Python" > > All highly recommended. > > Best of luck on your Python

Re: Fill Javascript form

2009-05-11 Thread Shawn Milochik
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

Re: Your Favorite Python Book

2009-05-11 Thread Shawn Milochik
It depends on what you want to do. If you still want to beef up on general knowledge, maybe skim through "The Python Cookbook" or something reference-like. If you feel ready to start doing something with Python, look into one of the recent titles that applies Python for a specific purpose. Example

Re: Downloading most recently modified files

2009-05-10 Thread Shawn Milochik
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 date for sorting, and the

Re: "Beginning Python Visualization" by Shai Vaingast

2009-05-10 Thread Shawn Milochik
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/listinfo/python-lis

Re: xml in python

2009-05-09 Thread Shawn Milochik
On Fri, May 8, 2009 at 3:46 AM, Rustom Mody wrote: > Can someone give me a heads up on xml parsing in python? > The context is that I want to write a simple docbook to text converter. > DOM is alright -- dont want to break my head with SAX just for performance > when my documents are not likely to

OT (humor): 'import antigravity' in action!

2009-05-09 Thread Shawn Milochik
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

Re: Downloading most recently modified files

2009-05-07 Thread Shawn Milochik
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

Re: Copy & Paste in a Dos box

2009-05-06 Thread Shawn Milochik
> 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

Re: Parsing text

2009-05-06 Thread Shawn Milochik
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

Re: Copy & Paste in a Dos box (was: Pyhton script to call another program)

2009-05-06 Thread Shawn Milochik
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.

Re: Copy & Paste in a Dos box (was: Pyhton script to call another program)

2009-05-06 Thread Shawn Milochik
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

Re: "Battleship" style game

2009-03-11 Thread Shawn Milochik
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

Re: The Python's regex different from Perl's , I want know what's the different?

2009-02-26 Thread Shawn Milochik
The regular expression syntax is basically exactly the same. The main difference is that a regex can't just be written into a statement as part of the syntax; you have to create a regular expression object and use its methods. So, instead of: new_thing =~ s/pattern/replacement/ it's: myPat

Re: "Battleship" style game

2009-02-25 Thread Shawn Milochik
On Wed, Feb 25, 2009 at 3:15 PM, Diez B. Roggisch wrote: > Not really. The point about properties is that you *can* make attribute > access trigger getter or setter code. > > But not that you do unless there is an actual reason for that. The way you > do it now is simply introducing clutter, with

Re: "Battleship" style game

2009-02-25 Thread Shawn Milochik
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

Re: "Battleship" style game

2009-02-25 Thread Shawn Milochik
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

"Battleship" style game

2009-02-25 Thread Shawn Milochik
I started learning Java for fun, and the first project assignment in the book is to create a game like "Battleship." So, of course, I wrote it in Python first, just for fun. I haven't had the time to look up all the Java syntax. So, here it is, fully functional. I thought I'd throw it out there an

Re: re.sub and named groups

2009-02-11 Thread Shawn Milochik
> > Book recommendation: _Mastering Regular Expressions_, Jeffrey Friedl > -- > Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ I wholeheartedly second this! The third edition is out now. -- http://mail.python.org/mailman/listinfo/python-list

Re: Searching a file for multiple strings (PS)

2009-02-01 Thread Shawn Milochik
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

Re: Searching a file for multiple strings (PS)

2009-01-31 Thread Shawn Milochik
On Sat, Jan 31, 2009 at 3:00 PM, Tim Chase wrote: >>> I'm fairly new with python and am trying to build a fairly simple >>> search script. Ultimately, I'm wanting to search a directory of files >>> for multiple user inputted keywords. I've already written a script >>> that can search for a singl

Re: spam update

2008-11-19 Thread Shawn Milochik
On Tue, Nov 18, 2008 at 11:23 AM, <[EMAIL PROTECTED]> wrote: > With some help from the python.org postmasters over the weekend I figured > out why some seemingly obvious spam messages seem to be making it to the > python-list@python.org mailing list. Messages gatewayed from Usenet don't > pass th

Re: How to eliminate quotes around string field written to a file.

2008-11-14 Thread Shawn Milochik
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

Re: Text based screens without ncurses

2008-11-14 Thread Shawn Milochik
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

Re: How to build the pysqlite? Where to find the "sqlite3.h"?

2008-11-05 Thread Shawn Milochik
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

Re: How to build the pysqlite? Where to find the "sqlite3.h"?

2008-11-05 Thread Shawn Milochik
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

Re: How to build the pysqlite? Where to find the "sqlite3.h"?

2008-11-05 Thread Shawn Milochik
>> 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

Re: How to build the pysqlite? Where to find the "sqlite3.h"?

2008-11-05 Thread Shawn Milochik
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

Re: Parse each line by character location

2008-11-05 Thread Shawn Milochik
I work with tab-delimited files for a living. Because of the same need you have, I created a Python script to do this. It has usage information that is easy to follow (just run it without any arguments). I hope someone else finds this useful. I have, and use it every month. It can be easily modifi

Re: How to build the pysqlite? Where to find the "sqlite3.h"?

2008-11-05 Thread Shawn Milochik
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

Re: How to protect website from access without authentication?

2008-11-03 Thread Shawn Milochik
This isn't really a Python question -- it's a Web development question. The easy answer is to just password protect the directory all the pages are stored in, and require a password. This can be set up using Apache or IIS. If what you really meant to ask was how to prevent anyone from accessing ce

Re: PYTHON WORKING WITH PERL ??

2008-11-01 Thread Shawn Milochik
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

Re: Exact match with regular expression

2008-10-31 Thread Shawn Milochik
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. >

Re: Windows DOS box redirection

2008-10-31 Thread Shawn Milochik
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

Re: Python does not get environment variable when using cron.

2008-08-18 Thread Shawn Milochik
Here's a more "English" version of what people are trying to explain: When you log into a Unix session, certain files in your home directory are read and add environment variables to your session. When you run a cron job, it does not do this. It still runs as "you" as far as permissions go, but it

Re: Testing for the first few letters of a string

2008-08-07 Thread Shawn Milochik
Check out the built-in string.startswith() method. -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing of a file

2008-08-06 Thread Shawn Milochik
> > 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

Re: Monitor and compare two log files in real time

2008-08-06 Thread Shawn Milochik
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

Re: Issue with regular expressions

2008-04-30 Thread Shawn Milochik
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

Re: Finally had to plonk google gorups.

2008-04-30 Thread Shawn Milochik
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

Checking for unique fields: performance.

2008-04-18 Thread Shawn Milochik
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

Re: Python for mobiles

2008-01-31 Thread Shawn Milochik
A better solution would surely be to get a Nokia S60 'phone, for which there is a native Python implementation. regards Steve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ Steve: Do you know if the Nokia E60i phone has this

Re: sudoku solver in Python ...

2008-01-23 Thread Shawn Milochik
On Jan 23, 2008, at 10:02 PM, Derek Marshall wrote: > This is just for fun, in case someone would be interested and because > I haven't had the pleasure of posting anything here in many years ... > > http://derek.marshall.googlepages.com/pythonsudokusolver > > Appreciate any feedback anyone w

Re: What is python?????

2007-11-16 Thread Shawn Milochik
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

Re: Python beginner!

2007-11-16 Thread Shawn Milochik
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

Re: What is python?????

2007-11-16 Thread Shawn Milochik
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 PROTECTED]> w

Re: New

2007-10-29 Thread Shawn Milochik
On 10/28/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi! > Am new to Python and am looking for a sample project that demonstrates > how to connect to MySQL, save data in MySQL database using a form on a > web page. > > Regards, > Joseph > > -- > http://mail.python.org/mailman/listinfo/python

Re: Regular Expression

2007-10-23 Thread Shawn Milochik
On 10/22/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to learn regular expressions, but I am having trouble with > this. I want to search a document that has mixed data; however, the > last line of every entry has something like C5H4N4O3 or CH5N3.ClH. > All of the letters

Re: [Tutor] matching a street address with regular expressions

2007-10-10 Thread Shawn Milochik
On 10/4/07, Ricardo Aráoz <[EMAIL PROTECTED]> wrote: > Christopher Spears wrote: > > One of the exercises in Core Python Programming is to > > create a regular expression that will match a street > > address. Here is one of my attempts. > > > street = "1180 Bordeaux Drive" > patt = "\d+

Re: [Tutor] data from excel spreadsheet to csv and manipulate

2007-10-03 Thread Shawn Milochik
On 10/3/07, sacha rook <[EMAIL PROTECTED]> wrote: > > Hi > > can anyone help with the best way to tackle this? > > I have a spreadsheet ms excel, that has a name column that I want to > extract to csv and manipulate as follows. > > The name column has data in this format > > Name > > Surname F

Re: Algebraic Modules For Python

2007-10-02 Thread Shawn Milochik
On 10/1/07, Brandon McGinty <[EMAIL PROTECTED]> wrote: > > > Hi All, > I know that there is probably a great deal of literature on this on the net, > but I don't have any time to go searching. -- > Brandon McGinty > McGinty Soft Ltd. > Website design, configuration, and maintenance > Python and

Re: [Tutor] Take if offline

2007-09-25 Thread Shawn Milochik
Since everyone else is replying to the list, I'll (top) post this: No, not really. He had to give everyone the rule once. Otherwise, he'd have to do it a hundred times a day, and monitor every single post to find out who he had to inform. He'd end up doing not much else with his life, and would fl

Re: Finding prime numbers

2007-09-20 Thread Shawn Milochik
On 9/20/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Sep 19, 1:31 pm, "Shawn Milochik" <[EMAIL PROTECTED]> wrote: > > > If you'd just search the archives, you would have found this: > > > > >http://groups.google.com/group/comp.lang.py

Re: Finding prime numbers

2007-09-19 Thread Shawn Milochik
> If you'd just search the archives, you would have found this: > > http://groups.google.com/group/comp.lang.python/browse_thread/thread/b134b2235e9c19a6/34857fb0b0b2a4b5?lnk=gst&q=prime+number&rnum=1#34857fb0b0b2a4b5 Yeah, but that's no fun. ;o) -- http://mail.python.org/mailman/listinfo/python

Re: [Tutor] Finding prime numbers

2007-09-19 Thread Shawn Milochik
Okay, I caught one bug already myself: for y in range(3,(math.sqrt(x) + 1)): should be for y in range(3,(int(math.sqrt(x)) + 1)): -- http://mail.python.org/mailman/listinfo/python-list

Re: [Tutor] Finding prime numbers

2007-09-19 Thread Shawn Milochik
Here's my attempt: #!/usr/bin/env python import math for x in range(3,1000,2): isPrime = True for y in range(3,(math.sqrt(x) + 1)): if x % y == 0: isPrime = False break if isPrime: print "%d is prime." % x Notes: This doesn't bother with ev

Re: Newbie question

2007-09-18 Thread Shawn Milochik
On 9/18/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Sep 18, 1:31 pm, "Shawn Milochik" <[EMAIL PROTECTED]> wrote: > > On 9/18/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > If I have a file name: AVC1030708.14. How do I s

Re: Newbie question

2007-09-18 Thread Shawn Milochik
On 9/18/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > If I have a file name: AVC1030708.14. How do I strip out certain > characters from the file name? I am so used to using MID, LEFT, and > RIGHT functions, that I have no idea how to do this in python? I have > had trouble as well with mos

Re: pattern combinations

2007-09-17 Thread Shawn Milochik
On 9/17/07, dorje tarap <[EMAIL PROTECTED]> wrote: > Hi all, > > Given some patterns such as "...t...s." I need to make all possible > combinations given a separate list for each position. The length of the > pattern is fixed to 9, so thankfully that reduces a bit of the complexity. > > For examp

Re: [Tutor] list iteration question for writing to a file on disk

2007-09-14 Thread Shawn Milochik
When you use "print," it automatically adds a newline (\n). You can avoid this by following the print line with a comma: print j, Or rstrip() the line before printing. Either way. -- http://mail.python.org/mailman/listinfo/python-list

Re: [Tutor] Just bought Python in a Nutshell

2007-09-14 Thread Shawn Milochik
My best advice: Skim it -- just flip the pages, glancing at each one without really reading it -- maybe just read the bold type. You'll find that very rewarding when you run into a problem in your coding and remember that you saw *something* which could be related. You will probably notice some bu

Re: How to Start

2007-09-14 Thread Shawn Milochik
On 9/14/07, James Stroud <[EMAIL PROTECTED]> wrote: > > Here's your recipe: > >1. begin coding until you hit a wall >2. read official tutorial until you figure out a solution >3. experiment in interactive interpreter >4. goto 1. > > I know this sounds obvious, but its the best way t

Re: Difference between two times (working ugly code, needs polish)

2007-09-12 Thread Shawn Milochik
> Just to be picky - your function returns the number of days between > two dates, but it's called isOld, which looks like it should return a > boolean. i.e. it looks like it would be used as: > > if not isOld(auctionDate, currentTime): > checkForBid() > > rather than how I assume it is used:

Re: Difference between two times (working ugly code, needs polish)

2007-09-11 Thread Shawn Milochik
> > I suppose really oneDay should be a global (i.e. outside the function > definition). Apart from that it would be hard to improve on: obvious, > easy to read, in short - pythonic. > > Are you concerned about daylight savings? That could certainly introduce > a whole new level of complexity into

Re: Difference between two times (working ugly code, needs polish)

2007-09-11 Thread Shawn Milochik
On 9/11/07, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2007-09-11, Shawn Milochik <[EMAIL PROTECTED]> wrote: > > > I have done what I wanted, but I think there must be a much better way. > > See the strptime() function in either the time or the datetime > module

Difference between two times (working ugly code, needs polish)

2007-09-11 Thread Shawn Milochik
I have done what I wanted, but I think there must be a much better way. Given two timestamps in the following format, I just want to figure out how far apart they are (in days, seconds, whatever). Format: -MM-DD_MM:SS Example: 2007-09-11_16:41 It seems to me that to do what I want, I need

Re: Python and Cron

2007-09-07 Thread Shawn Milochik
Any chance your import statements aren't coming in properly due to something in your environment in Python that's not being inherited by your cron job? -- http://mail.python.org/mailman/listinfo/python-list

Re: why should I learn python

2007-09-07 Thread Shawn Milochik
I wholeheartedly second the recommendation of this article: http://www.linuxjournal.com/article/3882 -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and Cron

2007-09-07 Thread Shawn Milochik
Could you send the output of "crontab -l" and the script you're running? It's probably an environment issue of some kind, but it's hard to say what blindly. -- http://mail.python.org/mailman/listinfo/python-list

Re: Text processing and file creation

2007-09-06 Thread Shawn Milochik
Here's my solution, for what it's worth: #!/usr/bin/env python import os input = open("test.txt", "r") counter = 0 fileNum = 0 fileName = "" def newFileName(): global fileNum, fileName while os.path.exists(fileName) or fileName == "": fileNum += 1 x = "%0.5d" % fileN

Re: Text processing and file creation

2007-09-05 Thread Shawn Milochik
On 9/5/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I have a text source file of about 20.000 lines. > >From this file, I like to write the first 5 lines to a new file. Close > that file, grab the next 5 lines write these to a new file... grabbing > 5 lines and creating new files until proces

Re: REGULAR EXPRESSION

2007-09-05 Thread Shawn Milochik
> Hi.. Thanks alot for finding time to help a beginner like me. What I > am trying to do is validate the input i get. I just want to take > numbers and numbers only. So if the input is 23+1 or 2/3 or 9-0 or > 7/0 , I want to find it using reg exp. I know there are other ways to > do this... but i t

Re: PythonAlley.com

2007-09-05 Thread Shawn Milochik
On 9/5/07, O.R.Senthil Kumaran <[EMAIL PROTECTED]> wrote: > * Shawn Milochik <[EMAIL PROTECTED]> [2007-09-05 10:27:08]: > > I bought the domain PythonAlley.com (and PerlAlley.com and > > > > Does anyone have any ideas as to what a wonderful use for > > Pytho

PythonAlley.com

2007-09-05 Thread Shawn Milochik
I bought the domain PythonAlley.com (and PerlAlley.com and RubyAlley.com) not too long ago. I had the inspiration to make some kind of community site thing, but never did get around to it. Does anyone have any ideas as to what a wonderful use for PythonAlley.com would be? I'd really like to do som

Re: [Tutor] Code reading for learning Python

2007-09-04 Thread Shawn Milochik
I second the Python Cookbook recommendation. -- http://mail.python.org/mailman/listinfo/python-list

Re: Asking all python programmers.

2007-08-28 Thread Shawn Milochik
On 8/27/07, Lamonte Harris <[EMAIL PROTECTED]> wrote: > Okay, I know you've guys told me millions of times to read the manual I've > read a lot of it. What do you recommend studying the most? Python is my > goal for the next year in the half. :) > > -- > http://mail.python.org/mailman/listinfo/py

Re: I Need help from all the group participants

2007-08-21 Thread Shawn Milochik
"Please enter John's heart rate." "Please notify me immediately if John's heart rate drops below 60 or exceeds 100." -- http://mail.python.org/mailman/listinfo/python-list

Re: reading a line in file

2007-08-20 Thread Shawn Milochik
Although you're technically correct, I think there's a knee-jerk anti-regex reaction, citing the meaningless overhead. If you're running many thousands of records or something then it becomes a small issue compared to a replace statement or something. But in most cases it makes no difference at all

Re: reading a line in file

2007-08-20 Thread Shawn Milochik
Everybody hates regexes. Except me. Discrimination! -- http://mail.python.org/mailman/listinfo/python-list

Re: reading a line in file

2007-08-20 Thread Shawn Milochik
Hopefully this will help (using your input file) #!/usr/bin/env python import re buildinfo = "input.txt" input = open(buildinfo, 'r') regex = re.compile(r"^\s*build.number=(\d+)\s*$") for line in input: if re.search(regex, line): print line buildNum = re.sub(r"^\s*build.numbe

Re: reading a line in file

2007-08-20 Thread Shawn Milochik
Write some code, even if it doesn't quite work, and post it. We'll help you fix it. You can open a file with: input = open("file.txt", "r") You can read a line with: someText = input.readline() You can loop through an open file like this: for line in input: #do something with line That s

Re: I Need help from all the group participants

2007-08-20 Thread Shawn Milochik
On 8/20/07, Boris Ozegovic <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > > The only sentence that comes to mind is: > > > > "I hope I never find myself in a hospital that uses your system." > > You are not funny. The system isn't for hospitals, it is for university > purposes. > > -- >

Re: regular expression dictionary search

2007-08-20 Thread Shawn Milochik
On 8/20/07, Paul McGuire <[EMAIL PROTECTED]> wrote: > On Aug 20, 10:35 am, "Shawn Milochik" <[EMAIL PROTECTED]> wrote: > > #!/usr/bin/env python > > > if __name__ == "__main__": > > > > print "The return for 'fr

Re: question

2007-08-20 Thread Shawn Milochik
> And Shawn, I didn't post any of my work because the network I work on > isn't > connected to the internet. So it didn't seem constructive to re-type > all of my > failed code just to satisfy your "standards" of proving that I've been > trying to > hack this myself for the past few days. All in a

  1   2   >