unicode :: Class unicode
[hide private]
[frames] | no frames]

Class unicode

object --+    
         |    
basestring --+
             |
            unicode

unicode(object='') -> unicode object unicode(string[, encoding[, errors]]) -> unicode object

Create a new Unicode object from the given encoded string. encoding defaults to the current default string encoding. errors can be 'strict', 'replace' or 'ignore' and defaults to 'strict'.

Instance Methods [hide private]
 
__add__(x, y)
x+y
 
__contains__(x, y)
y in x
 
__eq__(x, y)
x==y
unicode
__format__(S, format_spec)
Return a formatted version of S as described by format_spec.
 
__ge__(x, y)
x>=y
 
__getattribute__(...)
x.__getattribute__('name') <==> x.name
 
__getitem__(x, y)
x[y]
 
__getnewargs__(...)
 
__getslice__(x, i, j)
x[i:j]
 
__gt__(x, y)
x>y
 
__hash__(x)
hash(x)
 
__le__(x, y)
x<=y
 
__len__(x)
len(x)
 
__lt__(x, y)
x<y
 
__mod__(x, y)
x%y
 
__mul__(x, n)
x*n
 
__ne__(x, y)
x!=y
a new object with type S, a subtype of T
__new__(T, S, ...)
 
__repr__(x)
repr(x)
 
__rmod__(x, y)
y%x
 
__rmul__(x, n)
n*x
size of S in memory, in bytes
__sizeof__(S)
size of object in memory, in bytes
 
__str__(x)
str(x)
 
_formatter_field_name_split(...)
 
_formatter_parser(...)
unicode
capitalize(S)
Return a capitalized version of S, i.e.
unicode
center(S, width, fillchar=...)
Return S centered in a Unicode string of length width.
int
count(S, sub, start=..., end=...)
Return the number of non-overlapping occurrences of substring sub in Unicode string S[start:end].
string or unicode
decode(S, encoding=..., errors=...)
Decodes S using the codec registered for encoding.
string or unicode
encode(S, encoding=..., errors=...)
Encodes S using the codec registered for encoding.
bool
endswith(S, suffix, start=..., end=...)
Return True if S ends with the specified suffix, False otherwise.
unicode
expandtabs(S, tabsize=...)
Return a copy of S where all tab characters are expanded using spaces.
int
find(S, sub, start=... , end=...)
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].
unicode
format(S, *args, **kwargs)
Return a formatted version of S, using substitutions from args and kwargs.
int
index(S, sub, start=... , end=...)
Like S.find() but raise ValueError when the substring is not found.
bool
isalnum(S)
Return True if all characters in S are alphanumeric and there is at least one character in S, False otherwise.
bool
isalpha(S)
Return True if all characters in S are alphabetic and there is at least one character in S, False otherwise.
bool
isdecimal(S)
Return True if there are only decimal characters in S, False otherwise.
bool
isdigit(S)
Return True if all characters in S are digits and there is at least one character in S, False otherwise.
bool
islower(S)
Return True if all cased characters in S are lowercase and there is at least one cased character in S, False otherwise.
bool
isnumeric(S)
Return True if there are only numeric characters in S, False otherwise.
bool
isspace(S)
Return True if all characters in S are whitespace and there is at least one character in S, False otherwise.
bool
istitle(S)
Return True if S is a titlecased string and there is at least one character in S, i.e.
bool
isupper(S)
Return True if all cased characters in S are uppercase and there is at least one cased character in S, False otherwise.
unicode
join(S, iterable)
Return a string which is the concatenation of the strings in the iterable.
int
ljust(S, width, fillchar=...)
Return S left-justified in a Unicode string of length width.
unicode
lower(S)
Return a copy of the string S converted to lowercase.
unicode
lstrip(S, chars=...)
Return a copy of the string S with leading whitespace removed.
(head, sep, tail)
partition(S, sep)
Search for the separator sep in S, and return the part before it, the separator itself, and the part after it.
unicode
replace(S, old, new, count=...)
Return a copy of S with all occurrences of substring old replaced by new.
int
rfind(S, sub, start=... , end=...)
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].
int
rindex(S, sub, start=... , end=...)
Like S.rfind() but raise ValueError when the substring is not found.
unicode
rjust(S, width, fillchar=...)
Return S right-justified in a Unicode string of length width.
(head, sep, tail)
rpartition(S, sep)
Search for the separator sep in S, starting at the end of S, and return the part before it, the separator itself, and the part after it.
list of strings
rsplit(S, sep=... , maxsplit=...)
Return a list of the words in S, using sep as the delimiter string, starting at the end of the string and working to the front.
unicode
rstrip(S, chars=...)
Return a copy of the string S with trailing whitespace removed.
list of strings
split(S, sep=... , maxsplit=...)
Return a list of the words in S, using sep as the delimiter string.
list of strings
splitlines(S, keepends=False)
Return a list of the lines in S, breaking at line boundaries.
bool
startswith(S, prefix, start=..., end=...)
Return True if S starts with the specified prefix, False otherwise.
unicode
strip(S, chars=...)
Return a copy of the string S with leading and trailing whitespace removed.
unicode
swapcase(S)
Return a copy of S with uppercase characters converted to lowercase and vice versa.
unicode
title(S)
Return a titlecased version of S, i.e.
unicode
translate(S, table)
Return a copy of the string S, where all characters have been mapped through the given translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, Unicode strings or None.
unicode
upper(S)
Return a copy of S converted to uppercase.
unicode
zfill(S, width)
Pad a numeric string S with zeros on the left, to fill a field of the specified width.

Inherited from object: __delattr__, __init__, __reduce__, __reduce_ex__, __setattr__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__format__(S, format_spec)

 

Return a formatted version of S as described by format_spec.

Returns: unicode
Overrides: object.__format__

__getattribute__(...)

 

x.__getattribute__('name') <==> x.name

Overrides: object.__getattribute__

__getslice__(x, i, j)
(Slicling operator)

 

x[i:j]

Use of negative indices is not supported.

__hash__(x)
(Hashing function)

 

hash(x)

Overrides: object.__hash__

__new__(T, S, ...)

 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__

__repr__(x)
(Representation operator)

 

repr(x)

Overrides: object.__repr__

__sizeof__(S)

 

size of object in memory, in bytes

Returns: size of S in memory, in bytes
Overrides: object.__sizeof__

__str__(x)
(Informal representation operator)

 

str(x)

Overrides: object.__str__

capitalize(S)

 

Return a capitalized version of S, i.e. make the first character have upper case and the rest lower case.

Returns: unicode

center(S, width, fillchar=...)

 

Return S centered in a Unicode string of length width. Padding is done using the specified fill character (default is a space)

Returns: unicode

count(S, sub, start=..., end=...)

 

Return the number of non-overlapping occurrences of substring sub in Unicode string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Returns: int

decode(S, encoding=..., errors=...)

 

Decodes S using the codec registered for encoding. encoding defaults to the default encoding. errors may be given to set a different error handling scheme. Default is 'strict' meaning that encoding errors raise a UnicodeDecodeError. Other possible values are 'ignore' and 'replace' as well as any other name registered with codecs.register_error that is able to handle UnicodeDecodeErrors.

Returns: string or unicode

encode(S, encoding=..., errors=...)

 

Encodes S using the codec registered for encoding. encoding defaults to the default encoding. errors may be given to set a different error handling scheme. Default is 'strict' meaning that encoding errors raise a UnicodeEncodeError. Other possible values are 'ignore', 'replace' and 'xmlcharrefreplace' as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

Returns: string or unicode

endswith(S, suffix, start=..., end=...)

 

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

Returns: bool

expandtabs(S, tabsize=...)

 

Return a copy of S where all tab characters are expanded using spaces. If tabsize is not given, a tab size of 8 characters is assumed.

Returns: unicode

find(S, sub, start=... , end=...)

 

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

Returns: int

format(S, *args, **kwargs)

 

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces ('{' and '}').

Returns: unicode

istitle(S)

 

Return True if S is a titlecased string and there is at least one character in S, i.e. upper- and titlecase characters may only follow uncased characters and lowercase characters only cased ones. Return False otherwise.

Returns: bool

join(S, iterable)

 

Return a string which is the concatenation of the strings in the iterable. The separator between elements is S.

Returns: unicode

ljust(S, width, fillchar=...)

 

Return S left-justified in a Unicode string of length width. Padding is done using the specified fill character (default is a space).

Returns: int

lstrip(S, chars=...)

 

Return a copy of the string S with leading whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is a str, it will be converted to unicode before stripping

Returns: unicode

partition(S, sep)

 

Search for the separator sep in S, and return the part before it, the separator itself, and the part after it. If the separator is not found, return S and two empty strings.

Returns: (head, sep, tail)

replace(S, old, new, count=...)

 

Return a copy of S with all occurrences of substring old replaced by new. If the optional argument count is given, only the first count occurrences are replaced.

Returns: unicode

rfind(S, sub, start=... , end=...)

 

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

Returns: int

rjust(S, width, fillchar=...)

 

Return S right-justified in a Unicode string of length width. Padding is done using the specified fill character (default is a space).

Returns: unicode

rpartition(S, sep)

 

Search for the separator sep in S, starting at the end of S, and return the part before it, the separator itself, and the part after it. If the separator is not found, return two empty strings and S.

Returns: (head, sep, tail)

rsplit(S, sep=... , maxsplit=...)

 

Return a list of the words in S, using sep as the delimiter string, starting at the end of the string and working to the front. If maxsplit is given, at most maxsplit splits are done. If sep is not specified, any whitespace string is a separator.

Returns: list of strings

rstrip(S, chars=...)

 

Return a copy of the string S with trailing whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is a str, it will be converted to unicode before stripping

Returns: unicode

split(S, sep=... , maxsplit=...)

 

Return a list of the words in S, using sep as the delimiter string. If maxsplit is given, at most maxsplit splits are done. If sep is not specified or is None, any whitespace string is a separator and empty strings are removed from the result.

Returns: list of strings

splitlines(S, keepends=False)

 

Return a list of the lines in S, breaking at line boundaries. Line breaks are not included in the resulting list unless keepends is given and true.

Returns: list of strings

startswith(S, prefix, start=..., end=...)

 

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

Returns: bool

strip(S, chars=...)

 

Return a copy of the string S with leading and trailing whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is a str, it will be converted to unicode before stripping

Returns: unicode

title(S)

 

Return a titlecased version of S, i.e. words start with title case characters, all remaining cased characters have lower case.

Returns: unicode

translate(S, table)

 

Return a copy of the string S, where all characters have been mapped through the given translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, Unicode strings or None. Unmapped characters are left untouched. Characters mapped to None are deleted.

Returns: unicode

zfill(S, width)

 

Pad a numeric string S with zeros on the left, to fill a field of the specified width. The string S is never truncated.

Returns: unicode