top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to string module in Python?

+1 vote

I read the online help about string. It lists string constants, string formatting, template strings and string functions. After reading these, I am still puzzled about how to use the string module.

Could you show me a few example about this module?

posted Jun 2, 2015 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

I suggest you don't bother, it's effectively dead having been replaced by string methods. See here and
then compare to

answer Jun 2, 2015 by Kaushik
Similar Questions
0 votes

I am trying to make an HTTPS connection and read that HTTPS support is only available if the socket module was compiled with SSL support.

Can someone elaborate on this? Where can I get the socket module for HTTPS, or how do I build one if I have to?

0 votes

The type() builtin according to python docs, returns a "type object".

And in this module is bunch of what I assume are "type objects". Is this correct?

And type(), aside from being used in as an alternative to a class statement to create a new type, really just returns the object class, doesn't it?

>>> import types
>>> a = type(1)
>>> b = (1).__class__
>>> c = int
>>> d = types.IntType
>>> a is b is c is d

If type() didn't exist would it be much more of a matter than the following?:

def type(x): 
 return x.__class__

What is the purpose of type()?
What exactly is a "type object"? Is it a "class"?
What is the purpose of the types module?

I understand the purpose of isinstance and why it's recommended over something like (type(1) is int). Because isinstance will also return True if the object is an instance of a subclass.

>>> class xint(int):
 def __init__(self):

>>> x = xint()
>>> type(x) is int
>>> isinstance(x, int)
+1 vote

Recently, I have been studying OpenCV to detect and recognize faces using C++. In order to execute source code demonstration from the OpenCV website I need to run Python to crop image first. Unfortunately, the message error is ImportError: No module named Image when I run the Python script ( this script is provided by OpenCV website). I installed python-2.7.amd64 and downloaded PIL-1.1.7.win32-py2.7 to install Image library. However, the message error is Python version 2.7 required, which was not found in the registry. And then, I downloaded the script written by Joakim Löw for Secret Labs AB / PythonWare to register registry in my computer. But the message error is "Unable to register. You probably have the another Python installation".

Please help