Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
fString Nested forLoop
#3
Hi,
Thanks for the code line.
Regarding that f-String:
wb.active.cell(row, col).value = f'row:{row}, column:{col}'
can we break this down a bit?

wb.active # openpyxl method to assign an active worksheet
.cell # openpyxl method to activate a spreadsheet cell
(row, col) # where are you pulling this from?  The only usable code from above is 'rows' & 'columns' (the variable names)
.value # openpyxl method to assign a value within a cell
 =  # assignment operator
f' # python declaration for the start of a f-String
row: # where is this from?
{row},  # what is this pointing to?
column: # where is this from?
{col} # what is this pointing to?
' # end of python f-string
thanks,
phil
Reply


Messages In This Thread
fString Nested forLoop - by pcsailor - Oct-13-2018, 05:57 AM
RE: fString Nested forLoop - by buran - Oct-13-2018, 06:25 AM
RE: fString Nested forLoop - by pcsailor - Oct-13-2018, 08:09 AM
RE: fString Nested forLoop - by buran - Oct-13-2018, 08:50 AM
RE: fString Nested forLoop - by pcsailor - Oct-13-2018, 09:45 AM
RE: fString Nested forLoop - by volcano63 - Oct-13-2018, 09:51 AM
RE: fString Nested forLoop - by pcsailor - Oct-13-2018, 09:55 AM
RE: fString Nested forLoop - by volcano63 - Oct-13-2018, 12:10 PM

Forum Jump:

User Panel Messages

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