How to concatenate two integers in Python?

前端 未结 14 1968
南旧
南旧 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:16

    using old-style string formatting:

    >>> x = 10
    >>> y = 20
    >>> z = int('%d%d' % (x, y))
    >>> print z
    1020
    

提交回复
热议问题