About 94,800 results
Open links in new tab
  1. Python strings and integer concatenation - Stack Overflow

    I want to create a string using an integer appended to it, in a for loop. Like this: for i in range(1, 11): string = "string" + i But it returns an error: TypeError: unsupported operand type (s) for +: …

  2. How can I concatenate two integers in Python? - Stack Overflow

    Oct 11, 2012 · How do I concatenate two integer numbers in Python? For example, given 10 and 20, I'd like a returned value of 1020.

  3. How can I concatenate str and int objects? - Stack Overflow

    TypeError: can only concatenate list (not "str") to list Because of this, you need to do the conversion explicitly, whether what you want is concatenation or addition:

  4. How can I concatenate a string and a number in Python?

    Aug 8, 2011 · Since Python is a strongly typed language, concatenating a string and an integer, as you may do in Perl, makes no sense, because there's no defined way to "add" strings and …

  5. python - Print Combining Strings and Numbers - Stack Overflow

    Aug 18, 2012 · To print strings and numbers in Python, is there any other way than doing something like: first = 10 second = 20 print "First number is %(first)d and second number is …

  6. Concatenate string and int in Python 3 .4 - Stack Overflow

    In Python 2, your first line would concatenate "Type string: " and "123" and then print them. In Python 3, you are calling the print function with one argument, which returns None, and then …

  7. Concatenating string and integer in Python - Stack Overflow

    Python is an interesting language in that while there is usually one (or two) "obvious" ways to accomplish any given task, flexibility still exists. s = "string" i = 0 print (s + repr(i)) The above …

  8. python - How to resolve TypeError: can only concatenate str (not …

    Python working a bit differently to JavaScript for example, the value you are concatenating needs to be same type, both int or str... So for example the code below throw an error: print( "Alireza" …

  9. python - How can strings be concatenated? - Stack Overflow

    How to concatenate strings in python? For example: Section = 'C_type' Concatenate it with Sec_ to form the string: Sec_C_type See also: How do I put a variable’s value inside a string …

  10. Concatenating string and integers in pandas dataframe (based on ...

    Jul 5, 2017 · In my dataframe I have 2 columns: Country index (For example SK) id_number (usually 8 digit,for example:98341852) I want to concatenate them and it's easy: sk_df['id'] = …

Refresh