Go Back   CodingForums.com > :: Server side development > Other server side languages/ issues > Python

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-16-2010, 11:17 AM   PM User | #1
bennykelly13
New to the CF scene

 
Join Date: Nov 2010
Location: Ireland
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
bennykelly13 is an unknown quantity at this point
Simple Looping HELP

I am having a problem with a simple loop,but I cant seem to get it to work.Basically I have a function Currentcalculator taking in a number of predefined parameters plus changing parameters for V and T from an excel spreadsheet.The spreadsheet is in the format shown.
Temperature
Wind 1 2 3 4 5
1
2
3
4
I want to take a wind speed of 1,2,3,4 and temp of 1 and print the results to excel, then take wind speed of 1,2,3,4 and temp of 2,then a temp of 3,4 etc.Can anyone help me?here is my code

x1 = win32com.client.Dispatch('Excel.Application')
x1.Visible = 1
x1Wb = x1.Workbooks.Open('current calc.xlsx')
point = x1.Cells

row, col = 0, 0
V = ()
T = ()

i = 3
j = 3
k = 2
while i < 28:
while k < 8:

cells = point(i,1)
Wind = int(cells.Value)
V = Wind

cells = point(2,k)
Temp = cells.Value
T = Temp

dlr = Currentcalculator(T,80,V,45,0.00403,0.01813,0.5,0.5,0.000123,0.000183,75,20,900,100)

cells = point(j,k)
cells.Value = dlr
cells = point(j,k)
if i<28:

i = i+1
j = j+1
## if k < 6:
break

k = k+1
bennykelly13 is offline   Reply With Quote
Old 03-06-2011, 10:18 AM   PM User | #2
Kakao
Regular Coder

 
Join Date: Mar 2006
Location: Brasília, Brazil
Posts: 153
Thanks: 0
Thanked 0 Times in 0 Posts
Kakao is on a distinguished road
Use the code tag to format your code. Otherwise it is very difficult to read Python code.
Kakao is offline   Reply With Quote
Old 03-06-2011, 10:45 AM   PM User | #3
oesxyl
Master Coder


 
Join Date: Dec 2007
Posts: 6,682
Thanks: 436
Thanked 890 Times in 879 Posts
oesxyl is a jewel in the roughoesxyl is a jewel in the roughoesxyl is a jewel in the rough
Quote:
Originally Posted by Kakao View Post
Use the code tag to format your code. Otherwise it is very difficult to read Python code.
difficult? this is a nice substitute for impossible,

for op: left justification make impossible to see where each while loops, if's are ended. as Kakao said, use code tags please.

best regards
oesxyl is offline   Reply With Quote
Reply

Bookmarks

Tags
excel, loop, python

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:39 AM.


Advertisement
Log in to turn off these ads.