Re: Executing functions

2011-02-11 Thread DataSmash
Appreciate the responses, guys. I now see the difference between the ways I was trying to call function(s). R.D. -- http://mail.python.org/mailman/listinfo/python-list

Executing functions

2011-02-11 Thread DataSmash
Can someone help me understand why Example #1 & Example #2 will run the functions, while Example #3 DOES NOT? Thanks for your time! R.D. def One(): print "running fuction 1" def Two(): print "running fuction 2" def Three(): print "running fuction 3" # Example #1 fList = ["Two()","Thr

Re: Too much code - slicing

2010-09-16 Thread DataSmash
On Sep 16, 2:47 pm, Benjamin Kaplan wrote: > On Thu, Sep 16, 2010 at 3:35 PM, DataSmash wrote: > > I need to create a simple utility to remove characters from either the > > right or left side of directories. > > This works, but there has to be a better way.  I tried to use

Too much code - slicing

2010-09-16 Thread DataSmash
I need to create a simple utility to remove characters from either the right or left side of directories. This works, but there has to be a better way. I tried to use a variable inside the brackets but I can't get that to work. Can anyone think of a way to do this with less code? Thanks! import

Re: readline() & seek() ???

2008-06-05 Thread DataSmash
On Jun 5, 3:50 am, Carl Banks <[EMAIL PROTECTED]> wrote: > On Jun 4, 5:30 pm, DataSmash <[EMAIL PROTECTED]> wrote: > > > Hi group, > > I have a text file that contains thousands of lines and each line is > > 256 characters long. > > > This is my tas

readline() & seek() ???

2008-06-04 Thread DataSmash
Hi group, I have a text file that contains thousands of lines and each line is 256 characters long. This is my task: For each line in the file, move to the 25th character, if the character is a "T", move to the 35th character of the line and read 5 characters from there. Capture these 5 characters

Re: list manipulation

2008-04-22 Thread DataSmash
Joe & Mike, Thanks for your input! R.D. -- http://mail.python.org/mailman/listinfo/python-list

list manipulation

2008-04-22 Thread DataSmash
Hello, I have a list that looks like this: roadList = ["Motorways","Local","Arterial"] I want to apply some code so that the output looks like this: "Motorways;Local;Arterial" ...in other words, I want each item in the list separated by a ';' and then the whole thing surrounded by quotes. How c

Re: linux disc space

2008-02-15 Thread DataSmash
On Feb 15, 1:32 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: > Chris wrote: > > On Feb 15, 7:10 pm, DataSmash <[EMAIL PROTECTED]> wrote: > >> I simply want to capture the free disc space in a variable so that I > >> can compare changes. I'm aware of a few

linux disc space

2008-02-15 Thread DataSmash
I simply want to capture the free disc space in a variable so that I can compare changes. I'm aware of a few commands like "df -h" or "du - k", but I can't figure out how to capture those values as a variable. I also looked at os.statvfs(), but that output doesn't seem to make any sense at all to

Re: moving multiple directories

2007-04-16 Thread DataSmash
Thanks Larry, I'll give that a try... R.D. > > Use win32.moveFile method instead. This links directly to the Windows > MoveFile method that just moves the directory entries around. > > From Win32 Documentation: > > win32api.MoveFile > MoveFile(srcName, destName) > > Renames a file, or a directo

moving multiple directories

2007-04-16 Thread DataSmash
Hi, I need to organize thousands of directories full of files. I want to move these directories into other subdirectories. For example, all the directories that start with 01, move to a directory named "one", all directories that start with 02, move to a directory name "two", and so on I can't

Re: Search & Replace

2006-10-27 Thread DataSmash
Really appreciate all the all the different answers and learning tips! -- http://mail.python.org/mailman/listinfo/python-list

Search & Replace

2006-10-26 Thread DataSmash
Hello, I need to search and replace 4 words in a text file. Below is my attempt at it, but this code appends a copy of the text file within itself 4 times. Can someone help me out. Thanks! # Search & Replace file = open("text.txt", "r") text = file.read() file.close() file = open("text.txt", "w")

Re: os.chdir doesn't accept variables sometimes

2006-06-02 Thread DataSmash
A simple way to get all the files throughout the directory sturcture... You may have to rewrite the "CONVERTING" part. import os, glob for root, dirs, files in os.walk(os.getcwd()): for file in files: if file.endswith(".mp3"): print "File: " + os.path.abspath(os.path.join(

Re: Linking onClick event to other controls on the Frame

2006-05-30 Thread DataSmash
Hi Miki, I appreciate you taking the time to figure out what I was trying to do. This is exactly what I was looking for. I plan on studing this code and looking at the wxpython demo as you mentioned. Thanks again! R.D. Harles -- http://mail.python.org/mailman/listinfo/python-list

Linking onClick event to other controls on the Frame

2006-05-26 Thread DataSmash
Hello, I've created a simple form with 2 radio boxes, 2 text boxes and a button. When I click the button, I'd like to write each "choice" to a text file. I can't figure out how to "link" the onClick event to the other 4 controls. Any help would be much appreciated! R.D. Harles import wx, sys cla

Re: unzip zip files

2006-05-15 Thread DataSmash
Thanks! I ended up using the "-d" parameter. I did try the zipfile module but I couldn't figure it out, nor could I find any examples using it. I also didn't have any luck changing the working dircectory and making it work. import subprocess, os # Get all the zip files in the current directory. f

unzip zip files

2006-05-12 Thread DataSmash
I need to unzip all zip file(s) in the current directory into their own subdirectories. The zip file name(s) always start with the string "usa" and end with ".zip". The code below will make the subdirectory, move the zip file into the subdirectory, but unzips the contents into the root (current) d

front end GUI

2006-03-27 Thread DataSmash
I'm looking for software to create a simple GUI to execute python code for users in the office. The GUI would need a couple text boxes for user input and some option buttons and check boxes. Can anyone recommend free software that doesn't require a huge learning curve? My python skills are probably

Re: Confused: appending to a list

2006-03-23 Thread DataSmash
Thanks for explaining and all the additional ideas! R.D. -- http://mail.python.org/mailman/listinfo/python-list

Confused: appending to a list

2006-03-23 Thread DataSmash
I'm confused. Why is it that when I say "while len(list) < 5:", I get 5 items in my list. If I say "while len(list) < 6:", I get 6 items in the list and so on. I would think if I said "less than 5", I would get 4 items. Can anyone explain this? Thanks. R.D. # Start an empty list list = [] while

Re: import random module

2006-03-22 Thread DataSmash
Much Thanks! I deleted the random.pyc and renamed the script and everything is good! R.D. -- http://mail.python.org/mailman/listinfo/python-list

Re: import random module

2006-03-22 Thread DataSmash
Much Thanks! I deleted the random.pyc and renamed the script and everything is good! R.D. -- http://mail.python.org/mailman/listinfo/python-list

import random module

2006-03-22 Thread DataSmash
Hi, When I import the random module at the python interpreter, it works fine: >>> import random >>> x = random.randint(1,55) >>> print x 14 >>> BUT, when I put the same code in a python script: * random.py: import random x = random.randint(1,55) print x and run it at the command line, I get: Tr

Re: batch mkdir using a file list

2005-09-23 Thread DataSmash
Awesome! That worked! Much thanks to Peter and all of you who took the time to answer my question. R.D. -- http://mail.python.org/mailman/listinfo/python-list

Re: batch mkdir using a file list

2005-09-23 Thread DataSmash
OR...if python can't handle this type of text file, what do I need to do to remove the "\n" from the file? -- http://mail.python.org/mailman/listinfo/python-list

Re: batch mkdir using a file list

2005-09-23 Thread DataSmash
I am using bash shell on windows and I'm getting the error: TypeError: loop over non-sequence Is there any way around not messing with the text file. I want to batch generate the text lists as well. Thanks! -- http://mail.python.org/mailman/listinfo/python-list

batch mkdir using a file list

2005-09-23 Thread DataSmash
Hello, I think I've tried everything now and can't figure out how to do it. I want to read in a text list from the current directory, and for each line in the list, make a system directory for that name. My text file would look something like this: 1144 1145 1146 1147 I simply want to create thes