Forum: Python Oct 21st, 2009 |
| Replies: 2 Views: 203 If it's not builtin, it must be imported from another module.>>> getattr(list, '__module__')
'__builtin__'
>>> |
Forum: Python Sep 19th, 2008 |
| Replies: 2 Views: 2,249 Use string method strip() to remove newline characters.
for line in lines:
filemenu.add_cascade(label=line.strip()) |
Forum: Python Sep 14th, 2008 |
| Replies: 10 Views: 1,498 obj[:3] is a slice of the time.struct_time object. The asterisk preceding the list returned by the slice expands the list into individual elements. Example:>>> d = time.strptime('16/06/2010',... |
Forum: Python Sep 12th, 2008 |
| Replies: 10 Views: 1,498 I thought my use of enumerate() would give you enough information. Here's the code again with code to write to the Excel file (untested):print "\nLooping through the file, line by line."
workbook =... |
Forum: Python Sep 11th, 2008 |
| Replies: 10 Views: 1,498 Decide what types of objects that need to be converted. If needed, create a function to make each conversion type. An exception should occur on any failed conversion. If all conversions fail, return... |
Forum: Python Jul 14th, 2008 |
| Replies: 3 Views: 1,133 It appears that you omitted an operator:
yIntercept = y1 - (((y2 - y1)/(x2 - x1))(add operator here)(x1)) |
Forum: Python Jul 1st, 2008 |
| Replies: 4 Views: 1,604 >>> s = 'XXXXX -\n\t XXXX'
>>> ''.join(s.split())
'XXXXX-XXXX'
>>> |
Forum: Python May 7th, 2008 |
| Replies: 10 Views: 2,478 Try this:
csv.reader(str(self[filename]).split('\n')The argument to csv.reader can be any iterable object that produces a string each time its next() method is called. |
Forum: Python Mar 13th, 2007 |
| Replies: 6 Views: 2,472 If I understand you correctly, there are several ways:
# Update the local namespace
>>> for i in range(25):
... exec "%s = %d" % ('var'+str(i), 0) in None
# Update the global namespace... |