I'm trying to output two lines of code instead of two separate lines of code.
The output is twitter usernames and how many retweets they've made, using an excel sheet full of data with the module xlrl.
for cell in sheet.col(23):
print("username:",cell.value)
for cell in sheet.col(11):
print("has:",cell.value, "retweets")
for cell in sheet.col(19):
print("and mentioned:",cell.value)
print(cell.value)
I expected an output of:
username: NicoletteColl20
has: 8.0 retweet
and mentioned: GhostKumi
However the output is:
-username: NicoletteColl20
-username: STEM_Portsmouth
-has: 8.0 retweets
-has: 188.0 retweets
-and mentioned: mentions
-and mentioned: GhostKumi
Probably your selected column has 2 rows, you need to iterate over the rows too.
One option is remove the rows that you don't want:
sheet: [A,B,Usernames,...,Retweets,..., Mentions,...,C,D]
mysheet:[Usernames,Retweets,Mentions]
And do something like this:
for r in mysheet.row:
print("username:",r[0])
print("has:",r[1], "retweets")
print("and mentioned:",r[2])