Skip to content
Advertisement

Adding strings to a formatted string

I’m trying to add on to a string that is going into excel.

JavaScript

But what’s actually going into my cell in my sheet is:

JavaScript

The single quotes should be around the entire str(i), why is only the number getting the single quotes?

Advertisement

Answer

Not sure I understand the issue, but I also wasn’t able to reproduce your problem. Here’s how you could use f-strings to make your life easier though:

JavaScript

Output:

JavaScript

Also, as mentioned in the comments, using _ as a variable name on which you perform operations is bad practice. The _ is used to signify to other readers that the value of the variable is unimportant and will not be used later in any capacity. Always give your variables descriptive names!

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement