hi,
i found a module called xlwt (http://www.python-excel.org/) that can write to
Excel. i want the code to read from a file (robert.txt) and then write to excel
in a column. for eg:
cell col0, row0 = 0
cell col0, row1 = 0
cell col0, row2 = 0
cell col0, row3 = 1
cell col0, row4 = 0
cell col0,
David wrote:
class MyClass_2(object):
def __new__(self, condition):
if condition:
return object.__new__(self)
else:
return None
[...]
Spot on. It would require two "if" tests, one inside __new__() and
another in the code.
You will always need a
tee chwee liong wrote:
hi,
i found a module called xlwt (http://www.python-excel.org/) that can write to Excel. i want the code to read from a file (robert.txt) and then write to excel in a column. for eg:
cell col0, row0 = 0
cell col0, row1 = 0
cell col0, row2 = 0
cell col0, row3 = 1
cell col
On Thu, Mar 3, 2011 at 9:10 AM, Steven D'Aprano wrote:
> tee chwee liong wrote:
>
>> hi,
>> i found a module called xlwt (http://www.python-excel.org/) that can
>> write to Excel. i want the code to read from a file (robert.txt) and then
>> write to excel in a column. for eg:
>> cell col0, row0
okay so this is my comp sci lab
*
Problem: *ProductionTime.py It takes exactly 2 minutes and 7 second to
produce an item. Unfortunately, after 143 items are produced, the fabricator
must cool off for 5 minutes and 13 seconds before it can continue. Write a
program that will calculate the amount o
Am 03.03.2011 22:28, schrieb Andrew Bouchot:
okay so this is my comp sci lab
*
Problem:
*ProductionTime.py It takes exactly 2 minutes and 7 second to produce an
item. Unfortunately, after 143 items are produced, the fabricator must
cool off for 5 minutes and 13 seconds before it can continue. W
This isn't so much as a python problem as it is a simple math problem, and I
feel you are being lazy, but in the offchance you're having problems with
the '/' operator:
cooloff = (numitems/143)*313
total = cooloff + seconds
I think you are using python 2.6 (and I guess 2.7) or older based on you
On Thu, Mar 3, 2011 at 4:56 PM, Knacktus wrote:
> Am 03.03.2011 22:28, schrieb Andrew Bouchot:
>>
>> okay so this is my comp sci lab
>> *
>>
>> Problem:
>>
>> *ProductionTime.py It takes exactly 2 minutes and 7 second to produce an
>> item. Unfortunately, after 143 items are produced, the fabricat
On 03/03/2011 04:58 PM, James Reynolds wrote:
> You are almost assuredly going to get flamed for not having a descriptive
> title and for asking what is obviously homework questions
>
Maybe for not having a descriptive title, but there's nothing wrong with
coming to the list with homework!
The r
James Reynolds wrote:
[...]
You are almost assuredly going to get flamed for not having a descriptive
title and for asking what is obviously homework questions
At least Andrew did the right thing by being honest that it was a
homework question, and by showing the work he's done so far.
But y
> What does this comment mean? You don't have any commas in the file
> "robert.txt", and you don't actually do anything with or to commas in
> your code. I think that comment is false.
>
> > L = line.strip()
> > sheet.write(row,0,L)
>
> Here you write the entire contents of the file into one
tee chwee liong wrote:
What does this comment mean? You don't have any commas in the file
"robert.txt", and you don't actually do anything with or to commas in
your code. I think that comment is false.
L = line.strip()
sheet.write(row,0,L)
Here you write the entire contents of the file into
thanks Steven, i get what you mean now. final code works:
import xlwt
"""Reads robert.txt"""
# Create workbook and worksheet
wbk = xlwt.Workbook()
sheet = wbk.add_sheet('python')
row = 0 # row counter
f = open('robert.txt')
L = line.strip()
for c in L:
sheet.write(row,0,c)
I am creating a dictionary by parsing a text file.
The code is below:
backup_servers = {}
fo = open('c:/test/backup_shares.txt')
for line in fo:
backup_server = line.split(',')
backup_servers[backup_server[0]]=backup_server[1]
for i, v in backup_servers.items():
backup_shares = i
archive
On Fri, Mar 4, 2011 at 6:48 AM, Becky Mcquilling wrote:
> I am creating a dictionary by parsing a text file.
>
> The code is below:
> backup_servers = {}
> fo = open('c:/test/backup_shares.txt')
> for line in fo:
> backup_server = line.split(',')
> backup_servers[backup_server[0]]=backup_serve
Thanks, that helped. I took a second look and realized where I had tried
calling the .strip() method was wrong. Appreciate the pointer.
Becky
On Thu, Mar 3, 2011 at 5:37 PM, Kushal Kumaran <
kushal.kumaran+pyt...@gmail.com> wrote:
> On Fri, Mar 4, 2011 at 6:48 AM, Becky Mcquilling
> wrote:
>
16 matches
Mail list logo