Forum: Python 3 Hours Ago |
| Replies: 14 Views: 184 Use replace to swap out the punctuation for an empty string (''). Then use upper on both the original and the reversed string when you compare them so that the cases are the same. |
Forum: Python 1 Day Ago |
| Replies: 5 Views: 167 Your real problem is that you're using IDLE.
Your best bet is to switch to a better-featured (not to mention better-designed) IDE and run your scripts directly using python.exe or pythonw.exe
I... |
Forum: Python 7 Days Ago |
| Replies: 5 Views: 334 We're not here to do your homework for you. But good job on copy-pasting your assignment.
Dear MasterofPuppets,
You shouldn't be spoon feeding people looking for us to do their homework for... |
Forum: Python 8 Days Ago |
| Replies: 8 Views: 293 How about instead of just generating an arbitrary StaticText object, assign it to a persistent member of your class (let's call it self.login_status_text). Then instead of generating it each time,... |
Forum: Python 8 Days Ago |
| Replies: 17 Views: 354 Okay, you've solved your own problem you just don't even realize it yet. The circle function is looking for the values you suggested above. Everything you've provided is correct except the... |
Forum: Python 9 Days Ago |
| Replies: 17 Views: 354 |
Forum: Python 9 Days Ago |
| Replies: 7 Views: 245 The same way you create any .exe, using py2exe (http://www.py2exe.org/)! Search this forum for examples of setting up a setup file. |
Forum: Python 9 Days Ago |
| Replies: 1 Views: 115 If you're looking for native-looking windows apps you'll want to go with wxPython. This is a Python class wrapper for the wx.widgets toolkit, which is cross-platform and extremely powerful.
... |
Forum: Python 9 Days Ago |
| Replies: 17 Views: 354 So if getpos() is a function for a class object, then you forgot the most important detail. The parameter self!
Your function should be defined as such:
def getpos(self):
r1 = x,y =... |
Forum: Python 9 Days Ago |
| Replies: 2 Views: 171 It will be way simpler to use string formatting like so:
>>> print '%04X' % 16
0010
>>> print '%04X' % 245
00F5
>>> print '%04X' % 1024
0400
>>> print '%04X' % 4096
1000 |
Forum: Python 9 Days Ago |
| Replies: 2 Views: 202 You've simply forgotten to put the value of results into the string. Instead you mistakenly typed the name results. Here's how you should use string formatting to add the value:
... |
Forum: Python 11 Days Ago |
| Replies: 2 Views: 129 In the if statement you are using w[i+5].
This means that you need to make sure the maximum i plus 5 does not go out of bounds for the string. Let me demonstrate:
>>> w = 'aabbccdd'
>>> print... |
Forum: Python 11 Days Ago |
| Replies: 12 Views: 295 |
Forum: Python 11 Days Ago |
| Replies: 4 Views: 151 Basically you have to iterate over your "split" coefficients and then perform float conversion on each one independently. When you split them they return a list, which you'll be doing your iteration... |
Forum: Python 11 Days Ago |
| Replies: 6 Views: 245 Why yes, that is poorly coded. Good thing this is Python!
>>> x != 1 and x != 2 and x != 3
True
>>> x not in [1,2,3]
True
Data validation is extremely important for code that is... |
Forum: Python 11 Days Ago |
| Replies: 12 Views: 295 The best beginner's language is Assembly code. It will teach you how amazingly convenient a high level language like Python is.
That is sarcasm, but just read my response to this post in the... |
Forum: Python 11 Days Ago |
| Replies: 1 Views: 237 This (http://docs.python.org/library/cgi.html#installing-your-cgi-script-on-a-unix-system) should help. Don't ever underestimate the power of documentation. |
Forum: C++ 11 Days Ago |
| Replies: 6 Views: 192 I don't see any reason why you should skip your high school's C++ classes; however realize that your high school career doesn't really impact your job opportunities as much as your college career.
... |
Forum: Python 11 Days Ago |
| Replies: 9 Views: 268 This code has a lot of room for improvement. It would benefit you to read up on classes (http://docs.python.org/tutorial/classes.html)and functions... |
Forum: Python 11 Days Ago |
| Replies: 6 Views: 238 Can you explain what the bug is? Each call worked and printed "This is Test2's method."
What was the expected output?
EDIT: I think I understand now. You're saying the real program that you... |
Forum: Python 11 Days Ago |
| Replies: 10 Views: 316 Unless you run your script on a compatible platform, you will not be able to experience the joy of curses, no. If you're on windows you can either download and burn a linux live CD to boot from... |
Forum: Python 12 Days Ago |
| Replies: 1 Views: 111 You'll find it all here (http://www.pygame.org/news.html). Download pygame, tutorials, code examples, everything.
there's also a number of threads about pygame in this very forum. Just search... |
Forum: Python 12 Days Ago |
| Replies: 10 Views: 316 The platform can be simplified to mean your operating system. If you load up a python interpreter try the following exercise:
>>> import sys
>>> sys.platform
'win32'
>>> import curses... |
Forum: Python 12 Days Ago |
| Replies: 7 Views: 250 You're not an idiot, you're learning! It's good that you've solved your own problem. I actually just read an article about how a programming instructor put a teddy bear on his desk.
When... |
Forum: Python 12 Days Ago |
| Replies: 4 Views: 215 |
Forum: Python 13 Days Ago |
| Replies: 4 Views: 268 Gribouillis
I'm not sure if this has been fixed or not (perhaps you're using a newer version of Python where this bug has been eliminated) but when I use your path.join this is what I get:
>>>... |
Forum: Python 13 Days Ago |
| Replies: 4 Views: 215 You're likely getting an exception. When an exception is raised, the program quits.
The best way to catch the traceback is to open your own command prompt and run the program that way.
Go to... |
Forum: Python 13 Days Ago |
| Replies: 10 Views: 316 That's because curses isn't available for Windows. The documentation should probably specifically say that, but they actually just tip-toe around that fact:[Source = PyDocs... |
Forum: Python 13 Days Ago |
| Replies: 2 Views: 178 It would be easier for us to help if you gave us just the barebones code that produces this abnormality. Most users won't have every single one of those modules and it would be cumbersome to... |
Forum: Python 13 Days Ago |
| Replies: 8 Views: 247 Actually, it is printing the current value of name. The employee.name is always a space (' '), because you never change it. In your get_details function, you have created a new variable called name... |
Forum: Python 14 Days Ago |
| Replies: 6 Views: 245 In that case you'll want this:
c.execute("INSERT INTO a (Category, Value) VALUES (%s, %s)", tuple(row[0].split()))
Basically this takes the element [0], which represents that string 'test... |
Forum: Python 14 Days Ago |
| Replies: 1 Views: 186 According to your explanation:
def step(x,y):
pass
If you need something else you'll need to explain what you're trying to do and give some context. If you really want some code written for... |
Forum: Python 15 Days Ago |
| Replies: 6 Views: 245 You should uncomment your commit statement. You need to commit your transactions before they go through. |
Forum: Python 15 Days Ago |
| Replies: 3 Views: 186 Here, try this (http://tinyurl.com/yk7stjg) |
Forum: Python 15 Days Ago |
| Replies: 4 Views: 193 Alternately you could use modulus division like this:
>>> f = 123.456
>>> ipart = int(f)
>>> fpart = f % 1
>>> ipart
123
>>> fpart
0.45600000000000307
>>> |
Forum: Python 15 Days Ago |
| Replies: 5 Views: 249 To do it the way you're trying to do it, use this:
>>> num = 0
>>> mylist = []
>>>
>>> while num < 10:
... num += 1
... mylist += [num]
...
>>> for item in mylist: |
Forum: Python 16 Days Ago |
| Replies: 3 Views: 162 Or what about using chr() and then just adding 65?:
>>> def numtolet(num):
... return chr(num + 65)
...
>>> numtolet(1)
'B'
>>> numtolet(12)
'M'
>>> numtolet(14) |
Forum: Python 20 Days Ago |
| Replies: 3 Views: 164 You need to pass a second parameter to the open function which will declare the mode that you're opening the file in. Default (no parameter as in your case) is read mode or 'r'. You want either... |
Forum: Python 21 Days Ago |
| Replies: 7 Views: 428 Eval is what you're looking for:
>>> sports = [1,23,4]
>>> eval( 'sports' )
[1, 23, 4]
>>> |
Forum: Python 21 Days Ago |
| Replies: 13 Views: 442 Like this: my_boolean = False. Now the variable named my_boolean will act as your "flag" to tell you whether a number is "lucky" or not.
Here's what I posted above, maybe you didn't read it last... |