PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, October 17, 2022

[FIXED] How do I concatenate string and an integer?

 October 17, 2022     excel, integer, python, string, xlsxwriter     No comments   

Issue

act = input("Enter name of the activity")
cellone = int(input("Enter the order number of activity"))
cell1 = "A" + cellone
worksheet.write(cell1, act)
  

I'm trying to concatenate A and cellone but I'm getting some error saying that I can't concatenate string and an integer, is there a way to do this?


Solution

You can change int to a string representation using this:

cell1="A"+str(cellone)

Alternatively, f-string formatting will also work:

cell1=f"A{cellone}"


Answered By - SultanOrazbayev
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing