About 50 results
Open links in new tab
  1. String to Object in Python - Stack Overflow

    Oct 24, 2013 · If you want to serialise and deserialise python objects, pickle has already been pointed out a a very good, and standard, solution. Python also uses repr to obtain string representations of …

  2. python - How to concatenate (join) items in a list to a single string ...

    Sep 17, 2012 · For handling a few strings in separate variables, see How do I append one string to another in Python?. For the opposite process - creating a list from a string - see How do I split a …

  3. python - Concatenate 'str' and 'NoneType' objects - Stack Overflow

    Jan 16, 2015 · TypeError: cannot concatenate 'str' and 'NoneType' objects Of course, you probably don’t try to concatenate None explicitely but you have some variable instead, e.g. 'foo' + bar.

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

    As a rule, Python doesn't implicitly convert objects from one type to another 1 in order to make operations "make sense", because that would be confusing: for instance, you might think that '3' + 5 …

  5. How to change any data type into a string? - Stack Overflow

    Jul 8, 2010 · The rule of thumb for repr is that if it makes sense to return Python code that could be evaluated to produce the same object, do that, just like str, frozenset, and most other builtins do, but …

  6. How to specify that a parameter is a list of specific objects in Python ...

    I really like using docstrings in Python to specify type parameters when projects get beyond a certain size. I'm having trouble finding a standard to use to specify that a parameter is a list of specific …

  7. How to find out if a Python object is a string? - Stack Overflow

    Aug 19, 2009 · How can I check if a Python object is a string (either regular or Unicode)?

  8. python - Is there a difference between "==" and "is ... - Stack Overflow

    Since is for comparing objects and since in Python 3+ every variable such as string interpret as an object, let's see what happened in above paragraphs. In python there is id function that shows a …

  9. python - Convert list of strings into objects - Stack Overflow

    Dec 29, 2014 · 3 Assuming your strings are in a list called listofstrings, this creates a corresponsing list constructing objects from the strings (also assuming the __init__ method for the class expects one …

  10. How do I change the string representation of a Python class?

    Nov 6, 2015 · In Java, I can override the toString() method of my class. Then Java's print function prints the string representation of the object defined by its toString(). Is there a Python equivalent to Java's