Python Forum
This is a pain, is there a quicker way to do this?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
This is a pain, is there a quicker way to do this?
#6
Hi Gribouillis,

I was getting two consistent errors but I think I worked those two out. Now I'm not getting an error but I'm also not printing into the SS. I'm wondering if I should be using the .append method or a for-in loop instead of the enumerate function as I only have one list and don't need indexing. I'm new so my code-troubleshooting skills are more shotgunning than straight-line thinking. What's your thoughts?

Here's my code. The 'for v in values' is just to print to terminal to prove the output. I played around with different ways to work the code, but without success. I left it like this yesterday simply because it was not resulting in an error.

values = ['Mechanical / Chill Water Units Room continued', 'DP 3 Breakers', 'DP3-B08 SPD All 3 Green lights (Protected)',  'DP3-B12 CHILLER 3 Breaker is',  'DP3-B13 ATS-HPC-C Breaker is', 'DP3-B14 ATS-HPC-H Breaker is', 'DP3-B15 MUA 4 Breaker is', 'DP3-B17 ATS-HPD-H Breaker is', 'Notes']

    for v in values:
        print(v)

    # Original Code from Python-forum.io:

    def update_vertically(sheet, col, row, items):
        row = int(row)
        for i, value in enumerate(items):
            sheet['{}{}'.format(col, row+i)].value = value
    update_vertically(sheet, 'A', 2, ['0{}'.format(i) for i in range(3, 11)])
Thanks,
Phil
Reply


Messages In This Thread
RE: This is a pain, is there a quicker way to do this? - by pcsailor - Nov-04-2018, 03:24 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  3 easy questions for python programmers but 3 pain in the ass for me grjmmr 6 4,042 Jul-22-2018, 08:41 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020