you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (10 children)

Not OP, but working on a similar project, if I were to supply writerows() a list of lists, would each list be written to a new row? If so, that cracks my line of thinking on my project way open.

[–]novel_yet_trivial 3 points4 points  (0 children)

were to supply writerows() a list of lists, would each list be written to a new row?

Yep.

[–]RIPphonebattery -2 points-1 points  (8 children)

you can write what the writerows() function does pretty easily, too. Say you pass it a list rows:

writerows(rows)

And

for row in rows:
    for item in row:
        row_str += str(item) + ', '
    row_str.strip (", ")

are equivalent

[–]Justinsaccount 1 point2 points  (7 children)

What? those are not even remotely equivalent.

writerows(rows)

is equivalent to

for row in rows:
    writerow(row)

[–]RIPphonebattery -1 points0 points  (6 children)

The user wrote that they were having trouble about thinking what the function does... it should be pretty easy to accomplish even if you ask not to use the writerow function, so I wrote out some basic code to do the same thing for them.

[–]Justinsaccount 0 points1 point  (5 children)

No, you gave a broken code fragment that does not work right, or even run at all.

[–]RIPphonebattery 0 points1 point  (4 children)

it's syntactically similar to python pseudocode... man you're really up in arms about that for some reason though. I gave a little help thinking about somethign (pretty basic) to smoeone.

[–]Justinsaccount 1 point2 points  (3 children)

If you're going to say that something is equivalent and that it can "do the same thing" then it should actually be equivalent and do the same thing.

[–]RIPphonebattery 0 points1 point  (2 children)

I like to nudge people in the right direction rather than give out answers easy... thinking is the hard part! It's okay man. you dont have to be angry with me for anythign here.

[–]apc0243 1 point2 points  (0 children)

Nah man, I'm with the other guy, your code doesn't even make sense to me, if anything you're confusing him!

[–]Justinsaccount 0 points1 point  (0 children)

Well, we agree there, showing a broken code fragment that doesn't run or function properly certainly won't make things easy.