Forum: Python 1 Day Ago |
| Replies: 1 Views: 89 Can you clarify what isn't working? I'm going to take a wild guess and say that dict[c] is failing for "c" not being in the dictionary. In your first for loop you say c = c.rstrip() but then you... |
Forum: Python 1 Day Ago |
| Replies: 9 Views: 187 All of that can be turned into this:
def letter_number_alt(message):
alphabet = " abcdefghijklmnopqrstuvwxyz"
message_number = [alphabet.index(letter) for letter in message.lower() if... |
Forum: Python 1 Day Ago |
| Replies: 5 Views: 121 If your main frame is creating this OptionFrame (ie, if the "self" in the above code is actually the instance of MyFrame) then you should be doing just self.opframe = OptionFrame(self, -1, ""). See... |
Forum: Python 2 Days Ago |
| Replies: 5 Views: 121 I haven't done any work in wxPython for over two years but perhaps it's related to opframe having a parent of None. Perhaps its parent should be the main frame? |
Forum: Python 2 Days Ago |
| Replies: 9 Views: 187 Wow, that code is pretty long!
Here's a shortened version:
import string
# Strings are already iterable so we don't need to convert to list
message = raw_input('Enter a string: ')
# Make a... |
Forum: Python 2 Days Ago |
| Replies: 1 Views: 134 This (http://docs.activestate.com/komodo/5.0/shortcuts.html#shortcuts_all_codes) was found through the tutorials section on the Komodo Edit project hosted on active-state. |
Forum: Python 2 Days Ago |
| Replies: 5 Views: 121 It would be helpful if you showed us the relative code (ie, how you're opening the Optionframe and how you're destroying/closing it).
When you say "close both frames" do you mean click the "X"... |
Forum: Python 2 Days Ago |
| Replies: 7 Views: 225 Using a leading double underscore on a class member makes it psuedo-private; however with persistence you can still see/access the object (it's just not immediately apparent). There is no such thing... |
Forum: Python 10 Days Ago |
| Replies: 3 Views: 235 Is this psuedo-code that you're supposed to translate into Python? |
Forum: Python 12 Days Ago |
| Replies: 10 Views: 329 Hah, that's awesome...
This indicates that the "from" file is not located at C:/Python26/Renamer 3... Is that correct? C:/Python26 is likely the current working directory (it's where python.exe is... |
Forum: Python 12 Days Ago |
| Replies: 6 Views: 373 So you want to use the value of Templng for the default value of the to parameter in the translate function? |
Forum: Python 12 Days Ago |
| Replies: 4 Views: 2,541 Those are forward slashes, which do not need to be escaped (the escape character is \, which is backslash) |
Forum: Python 12 Days Ago |
| Replies: 6 Views: 373 It's hard to tell whether you did this or not since you didn't give us all your code, but I'm assuming that before assigning to Templng you used global Templng to let the local scope know you meant... |
Forum: Python 15 Days Ago |
| Replies: 2 Views: 210 What are you asking for help with? |
Forum: Python 16 Days Ago |
| Replies: 3 Views: 209 Better yet: I'll give you about 57,900 examples (http://tinyurl.com/ydd96ld) |
Forum: Python 16 Days Ago |
| Replies: 4 Views: 244 Type your python command (*if you haven't set it up you'll need to use the full pathname to python.exe or pythonw.exe), then the name of your script, then the command line arguments... here's an... |
Forum: Python 16 Days Ago |
| Replies: 7 Views: 278 This is the section he's referring to:
def main():
filename=raw_input ("Gimme a picture.")
n=raw_input ("How many times would you like it tiled?")
img=Image.open(filename)
... |
Forum: Python 17 Days Ago |
| Replies: 3 Views: 249 You have a number of issues in your code revolving around scope.
Here are the first few that jumped out at me:
1) In your dig_sum function, you refer to i but never define it (in your while... |
Forum: Python 17 Days Ago |
| Replies: 7 Views: 278 Welcome to the forums.
EDIT: OP Updated post with Code tags
Also, when asking about a specific error you get, it would help if we could see the entire traceback (which helps to identify exactly... |
Forum: Python 17 Days Ago |
| Replies: 2 Views: 246 When performing an import * in Python, you as a developer actually have power over what is included in that "import all" statement. By populating your package with either an __all__.py file or an... |
Forum: Python 21 Days Ago |
| Replies: 2 Views: 190 With the limited information that you've provided my only guess would be that your Python installation is corrupted. You should reinstall. |
Forum: Python 22 Days Ago |
| Replies: 2 Views: 200 When you return an object it isn't just automagically added to the current namespace... you need to actually store it in something.
All you'll need to do is say graph = plot_it(...), savvy? |
Forum: Python 22 Days Ago |
| Replies: 11 Views: 479 Yes, but be forewarned it's psuedo-private. You can still see and access the variable, it's just obfuscated with the Class name. Look:
>>> class Cpriv(object):
... def __init__(self):
... ... |
Forum: Python 22 Days Ago |
| Replies: 3 Views: 213 A dictionary. The key is the number, the value is the function.
Generate random number, then do something like my_function_dict[my_random_number](). Get it?
EDIT: To illustrate:
>>> def... |
Forum: Python 22 Days Ago |
| Replies: 4 Views: 190 What is that? What are you doing?
EDIT: Also remember that dict is a reserved word in Python I suggest that you change the name |
Forum: Python 22 Days Ago |
| Replies: 4 Views: 212 How about print ' || '.join([each.string for each in tag])... I've never used BeatifulSoup so I don't know about the whole tag.string thing that you're doing... |
Forum: Python 22 Days Ago |
| Replies: 4 Views: 212 Try inserting a print tag trace statement right before the for loop to make sure all elements in tag are actually strings... |
Forum: Python 22 Days Ago |
| Replies: 6 Views: 187 You would use chmod with the target being the directory
That or simply login as root before executing the script. |
Forum: Python 22 Days Ago |
| Replies: 6 Views: 187 Ok, so it's most likely that the folder you're trying to open the file in doesn't have write permissions for the user that is running the python script. You could either run the script as root or... |
Forum: Python 22 Days Ago |
| Replies: 6 Views: 187 What platform is this? Windows XP, Ubuntu Linux, Mac OSX, etc?
There's a number of possibilities here. Most likely the folder you're working in doesn't give you write permissions. |
Forum: Python 22 Days Ago |
| Replies: 7 Views: 250 What functions?
The first code is not working because you're not iterating over your input anymore.
The second code is not working because your indentation is royally screwed up. Everything... |
Forum: Python 22 Days Ago |
| Replies: 7 Views: 250 Unless your teacher is specifically telling you to use them in this manner, you really don't. And if he/she is, then I feel bad for you because your teacher is a terrible programmer.
If you're... |
Forum: Python 22 Days Ago |
| Replies: 3 Views: 212 In the future, please use code tags when posting code. It will allow the forum members here to read your post easily and will give you answers quicker (and of better quality). To use code tags... |
Forum: Python 22 Days Ago |
| Replies: 7 Views: 250 My first suggestion is to remove the giant try/except block. If you make a syntax error your program will quit and never tell you the reason why. That is extremely poor Python coding and opens the... |
Forum: Python 23 Days Ago |
| Replies: 2 Views: 229 I'd look into beautifulsoup if you're looking to break this thing down into an object hierarchy type structure. I haven't used it much, but I know there's plenty of examples on this site of how to... |
Forum: Python 23 Days Ago |
| Replies: 1 Views: 218 The method os.getcwd() can only ever return a single string. There's ever only one current working directory, so when you're saying for d in os.getcwd(), you're actually iterating over the string... |
Forum: Python 25 Days Ago |
| Replies: 2 Views: 183 Something like this perhaps:
for idx_i, each_sublist in enumerate(main_object):
for idx_j, each_string in enumerate(each_sublist):
if each_string == my_letter:
print... |
Forum: Python 25 Days Ago |
| Replies: 4 Views: 182 If you search the forum you'll see this question has been asked a bajillion times.
Here's an example from earlier today (http://www.daniweb.com/forums/post1041001.html#post1041001). |
Forum: Python 25 Days Ago |
| Replies: 3 Views: 188 Just a minor logic error. This should be:
if player[0] != "r" and player[0] != "p" and player[0] != "s":
print "incorrect choice entered" |
Forum: Python 25 Days Ago |
| Replies: 14 Views: 561 Okay... how about this:
>>> data_dict = {
... '1234': ['Matt', '2.5', 'CS'],
... '1000': ['John', '4.0', 'Music'],
... '1023': ['Aaron', '3.1', 'PreMed'],
... '1001': ['Paul', '3.9',... |