Forum: Python Sep 15th, 2009 |
| Replies: 5 Views: 827 From what you've said, it sounds like you have to print out elements 3 through 6 (if 0 is the first element) of a list. This will print those 4 elements, doesn't matter how long the list is.
n =... |
Forum: Python Aug 28th, 2009 |
| Replies: 7 Views: 314 I would suggest that instead of storing the data in separate lists, store all the data in a class.
example:
class Data:
def __init__(self,row,value,var1,var2):
self.row = row
... |
Forum: Python Aug 27th, 2009 |
| Replies: 2 Views: 223 Very interesting. Thanks. I'll keep this in mind. |
Forum: Python Aug 27th, 2009 |
| Replies: 2 Views: 223 Hi all,
Here's my issue:
>>> a = [1,2,3] #all good so far
>>> b = a #make a copy of a, called b
>>> b.remove(1) #remove value 1 from b ONLY
>>> print a #grrr, value has also been removed... |
Forum: Python Aug 14th, 2009 |
| Replies: 194 Views: 85,516 Or, sort a list of class objects by an attribute (similar idea as above):
import operator
import string
def normcaps(strg):
s = string.upper(strg[0]) + strg[1:]
return s |
Forum: Python Aug 14th, 2009 |
| Replies: 3 Views: 291 Should be noted that Python won't mutate your string. If you say s = "'Quote Example'\tby person\n" s will always be that string unless you reassign it. When you print it, python interprets the... |
Forum: Python Aug 14th, 2009 |
| Replies: 7 Views: 390 Here's where you should always start:
What is your input to the script? This should be something tangible, a trigger, a file, some sort of a parameter you are going to pass.
What will your... |
Forum: Python Aug 13th, 2009 |
| Replies: 7 Views: 500 Also, you might want to make sure you are always dealing withe floats:
>>> float(499.99)
499.99000000000001
>>> float(500) - float(499.99)
0.0099999999999909051
>>> round(float(500) -... |
Forum: Python Aug 12th, 2009 |
| Replies: 2 Views: 214 Yea, I'm trying to figure out the Net Panel. Firebug seems pretty powerful.
I did get this working though. Turned out to be an issue about using 'www' or not using 'www.' Durrrr.... |
Forum: Python Aug 12th, 2009 |
| Replies: 2 Views: 214 Hi all,
I'm trying to mimic an html form that calls a script on the web. When I put the form together on a page, it works, and I was wondering if there was a way I could "scrape" this post... |
Forum: Python Aug 11th, 2009 |
| Replies: 7 Views: 390 More info, plz.
State clearly what you are trying to to. Are you going to try and use python to parse the results (via html scrape)? Because that would likely mean regular expressions and that... |
Forum: Python Aug 10th, 2009 |
| Replies: 8 Views: 345 Whenever I start a script I usually write out in plain English what I want to do. It will keep you organized and you will never not know "where to start." Comment out the plain english, and script... |
Forum: Python Aug 10th, 2009 |
| Replies: 1 Views: 225 Hey all,
Here's my problem: I have a class that I want to be able to save and and load. But I need the class to be mutable I guess. Check it out:
class Tool:
def... |
Forum: Python Aug 5th, 2009 |
| Replies: 4 Views: 282 Heh heh, I might have jumped the gun there a bit. It doesn't look like you can attach a scrollbar to a Frame. I just gave you the first answer off the top of my head. Seems like you should be able... |
Forum: Python Aug 5th, 2009 |
| Replies: 5 Views: 323 What does this line do?
Pmw.initialise(root)
Check if you're getting an error, run it from IDLE. Even if the window remains open there could still be an error. |
Forum: Python Aug 5th, 2009 |
| Replies: 14 Views: 604 No way, was that a spammer? That was way slick. Had me fooled. |
Forum: Python Aug 5th, 2009 |
| Replies: 4 Views: 282 Stick both canvases in a mainframe, and attach the scrollbar to the mainframe. |
Forum: Python Aug 5th, 2009 |
| Replies: 1 Views: 597 Neither am I. Interacting with mail servers like yahoo and gmail is unfortuanaetly not as simple as: connect, login, email. See below for what I use, but you may need to experiment with yahoo. The... |
Forum: Python Aug 5th, 2009 |
| Replies: 2 Views: 195 That's nice. Have a question? ;) |
Forum: Python Aug 5th, 2009 |
| Replies: 5 Views: 323 Your code looks somewhat roundabout. Quick sanity check, make the Label this and see if it works:
label = Label(parent,text = 'Hi world!',background = 'yellow')
If theres a highlighted piece... |
Forum: Python Aug 4th, 2009 |
| Replies: 12 Views: 613 Hmmm, interesting. I'm going to check out PyCrust, since I'm NOT a fan of IDLEs many issues... |
Forum: Python Aug 4th, 2009 |
| Replies: 12 Views: 613 Heh heh, I love eclipse, but the interactive shell (a la IDLE) is pretty darn awesome for testing stuff out. Example:
>>> #start with your function
>>> def count_chars(char,string):
"""A... |
Forum: Python Aug 3rd, 2009 |
| Replies: 3 Views: 181 Well you can say Label(root,text="I'm a label!").grid(row = 0,column = 0) so no, you don't have to. |
Forum: Python Aug 3rd, 2009 |
| Replies: 2 Views: 265 I would say it depends on your server configuration. Python has a MySQLdb module that lets it interact easily with MySQL databases (you would likely have to install it), but I'm not totally sure in... |
Forum: Python Aug 3rd, 2009 |
| Replies: 1 Views: 230 http://www.google.com/search?q=flash+command+line+arguments
Welcome to the interwebs. Use 'em. |
Forum: Python Aug 3rd, 2009 |
| Replies: 3 Views: 181 Hey all,
Working on a medium sized Tkinter app. I have it working fine, but I feel like the app isn't as clean as I would like it to be, namely because I have a million labels and different... |
Forum: Python Aug 3rd, 2009 |
| Replies: 16 Views: 701 playground.nubeachfilms.org
nudebeachfilms.org/playground
Now you've seen everything! :) |
Forum: MySQL Jul 31st, 2009 |
| Replies: 2 Views: 314 Durrr... Thanks for the snippet, I'll try and implement, and post back when I'm done. |
Forum: Python Jul 31st, 2009 |
| Replies: 16 Views: 701 Errrr...stop me if I'm stating the obvious, but if your domain is mycompany.com, and the subdomain is pstats.mycompany.com, "pstats" will be a folder in the main "www" directory of mycompany.com. ... |
Forum: Python Jul 31st, 2009 |
| Replies: 10 Views: 765 What is the obsession with global variables? Seriously.
Pass the necessary elements to your function, and return them back. You seem to be doing half of this, but you are not putting your return... |
Forum: Python Jul 31st, 2009 |
| Replies: 7 Views: 278 Honestly you should never cut and paste. Ask questions about bits you don't understand. Rename variables at the very least so that you know where everything is going.
When you say it's not... |
Forum: Python Jul 30th, 2009 |
| Replies: 7 Views: 278 Here's a function to send email from a gmail account:
def email(usertuple,sender,to,subject,msg):
"""Sends an email from a gmail account"""
(login,pswd) = usertuple
print... |
Forum: Python Jul 29th, 2009 |
| Replies: 7 Views: 278 How's this for a solution:
Instead of worrying about what email client your users are using, have python send the email for them, through an account that you set up!
It's fairly easy to get... |
Forum: MySQL Jul 29th, 2009 |
| Replies: 2 Views: 314 Hey all,
Here's my problem: php/mysql noob here.
I have an admin section on the website, and I have successfully password protected all the php pages in that directory using sessions. I... |
Forum: Python Jul 28th, 2009 |
| Replies: 33 Views: 978 This thread makes my head hurt. Do you need to store all the info about the cars in a python module? What about a csv? Also, if you're going to call a class in a module, that class has to be part... |
Forum: Python Jul 28th, 2009 |
| Replies: 25 Views: 1,070 Link directly to it.
ie: somesite.com/myscript.py
But make sure your print statements are "html"
ie: print "<P> Hello shadowickman </p> "
There are certain rules you have to follow for... |
Forum: Python Jul 28th, 2009 |
| Replies: 4 Views: 431 Okay, I quickly glanced over your code. It doesn't look like it works at all. Am I right?
Note that subprocess.Popen only creates the instance, it doesn't run the command line. You need to use... |
Forum: Python Jul 28th, 2009 |
| Replies: 11 Views: 956 def get_xml(uri,login):
netlock = urlparse.urlparse(uri)
pswdMngr = urllib2.HTTPPasswordMgrWithDefaultRealm()
... |
Forum: Python Jul 28th, 2009 |
| Replies: 1 Views: 229 Mmkay. The first step is determining what your input and output are. I believe the input is the cheques.data file, and your output is the XHTML that looks something like this:
<!DOCTYPE html... |
Forum: Python Jul 28th, 2009 |
| Replies: 52 Views: 1,400 You should really check out the tutorial on python.org. Anyway, since you're having trouble wrapping your head around try except, here's a basic outline that handles bad choice slightly differently... |