No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
Re:
I'm having trouble getting this program to keep going through the lines in the first loop. It just prints out the output for the first (searchline) and stops. Can anyone help me to figure out why it won't keep reading the lines in the birthday file? [CODE] import string def … |
|
Why does this make sense in 3.1? [code]>>> a = b'\x01\x02' >>> a[0] 1 >>> a[0:1] b'\x01' >>> a[0] == a[0:1] False >>> a = '\x01\x02' >>> a[0] '\x01' >>> a[0:1] '\x01' >>> a[0] == a[0:1] True[/code] Shouldn't we get True for both comparisons? |
|
Re:
I am trying to replace a section of code within a series of php files. I open the files, read the contents into a "sourcecode" variable and locate a section of code. I then capture this section in a variable like this: [code=python]phpsection=sourcecode[phpstart+2:phpend][/code] The problem is after I locate this … |
|
|
Re:
Hey guys, I am making a program called 'Weather Watch' which basically gets weather updates for any city you type in. For now, it only gets info for a particular city. I don't know how to search for the term entered in [url]www.weather.com[/url] and then get the updates. The code … |
I'm trying to parse xml, but am missing something. In the following, I can get the key, but not the value [code]from xml.dom import minidom xmlstring = '''<search ver="3.0"> <loc id="USAR0433" type="1">Paris, AR</loc> <loc id="USID0192" type="1">Paris, ID</loc> </search>''' dom = minidom.parseString(xmlstring) r = dom.getElementsByTagName('search')[0] res = [] for x in … |
|
I've been having problems with email in 3.1.1. I decided to try the examples from the docs. Alas, the first I tried didn't work. I tried to send a directory whose only contents were a single zip file. [code]#!/usr/bin/env python """Send the contents of a directory as a MIME message.""" … |
|
Does the documentation mean what it says? The 3.1 library reference says quopri.encodestring takes a string, but feeding it a string results in an error. [QUOTE]quopri.encodestring(s[, quotetabs]) Like encode(), except that it accepts a source string and returns the corresponding encoded string. [/QUOTE] However, feeding this a str results in … |
|
The following fails with an error message about not being able to encode the euro char. It works fine without the €. I have the feeling I'm missing something simple here, but can't figure it out. A fix would be appreciated. I'd like to use this in 2.5.4 and 3.1 … |
|
Re:
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: [CODE=python]class Tool: def __init__(self,name,function): self.name = name self.function = function self.savename = self.name + '.txt' def save(self): … |
|
I have some code which "requires python 2.5.2 or bytecode compatible." Would 2.5.4 work? 2.6.2? Any harm in installing either of these on the same machine as 3.1 (separate directories)? Windows XP if that matters. |
|
Re:
the cursus i'm taking on python (free on internet). said i know enough and that i should try creating some simple games like oxo. the problem is that i don't know how the create a framework for such a game any help is welcome. mathijs p.s. my english may not … |
|
Is there a way to place widgets on pixel coordinates rather than row, column coordinates in tkinter? For example, if I'm using grid, if I have a 20x10 Text box at row 0, column 0 and want to place three buttons to the right of the textbox, one button over … |
|
I have a tkinter/python program which does something time consuming when I push a button. I'd like to give the user progress reports by updating a label field at each stage of the time consuming process. If have simple loop to the effect [code] for x in y: dosomething(x) self.label1.config(text … |