How to concatenate two integers in Python?

前端 未结 14 1948
南旧
南旧 2020-12-15 03:51

How do I concatenate two integer numbers (for example: 10 and 20) in Python to get a returned value of 1020?

14条回答
  •  青春惊慌失措
    2020-12-15 04:27

    Cast both to a string, concatenate the strings and then cast the result back to an integer:

    z = int(str(x) + str(y))
    

提交回复
热议问题