All Samples(9509) | Call(9081) | Derive(0) | Import(428)
split(s [,sep [,maxsplit]]) -> list of strings Return a list of the words in the string s, using sep as the delimiter string. If maxsplit is given, splits at no more than maxsplit places (resulting in at most maxsplit+1 words). If sep is not specified or is None, any whitespace string is a separator. (split and splitfields are synonymous)
def split(s, sep=None, maxsplit=-1):
"""split(s [,sep [,maxsplit]]) -> list of strings
Return a list of the words in the string s, using sep as the
delimiter string. If maxsplit is given, splits at no more than
maxsplit places (resulting in at most maxsplit+1 words). If sep
is not specified or is None, any whitespace string is a separator.
(split and splitfields are synonymous)
"""
return s.split(sep, maxsplit)
import socket from select import select from string import split,strip,join import sys,os sys.path.insert(1, os.path.join(sys.path[0], '..'))
def doCmd(con,txt):
global Who
if txt[0] == '/' :
cmd = split(txt)
if cmd[0] == '/select':
Who = cmd[1]
print "%s selected" % cmd[1]
src/e/d/Edwin-HEAD/scripts/msg/examples/pypguijab.py Edwin(Download)
#!/usr/bin/env python2.2 # we require Python 2.2 because PyPicoGUI does import PicoGUI import socket from select import select from string import split,strip,join
def doCmd(con,txt):
global Who
cmd = split(txt)
if cmd[0] == 'presence':
to = cmd[1]
type = cmd[2]
con.send(jabber.Presence(to, type))
src/d/i/diksel-HEAD/trunk/thirdparty/pyjamasdev/examples/infohierarchy/public/services/EchoService.py diksel(Download)
#!/usr/bin/env python
import os
from string import split, strip
def get_directory_info(prefix, pth, recursive):
res = []
src/d/i/diksel-HEAD/thirdparty/pyjamasdev/examples/infohierarchy/public/services/EchoService.py diksel(Download)
#!/usr/bin/env python
import os
from string import split, strip
def get_directory_info(prefix, pth, recursive):
res = []
src/p/y/pyjamas-0.7/examples/infohierarchy/public/services/EchoService.py Pyjamas(Download)
#!/usr/bin/env python
import os
from string import split, strip
def get_directory_info(prefix, pth, recursive):
res = []
src/p/r/Products.ZSQLMethods-2.13.3/src/Shared/DC/ZRDB/RDB.py Products.ZSQLMethods(Download)
############################################################################## '''Class for reading RDB files''' from string import split, strip, lower, upper, atof, atoi, atol, find, join import DateTime,re from Missing import MV from array import array
def parse_text(s):
if find(s,'\\') < 0 and (find(s,'\\t') < 0 and find(s,'\\n') < 0): return s
r=[]
for x in split(s,'\\\\'):
x=join(split(x,'\\n'),'\n')
r.append(join(split(x,'\\t'),'\t'))
return join(r,'\\')
line=line[:-1]
if line and line[-1:] in '\r\n': line=line[:-1]
self._names=names=split(line,'\t')
if not names: raise ValueError, 'No column names'
aliases=[]
line=line[:-1]
if line[-1:] in '\r\n': line=line[:-1]
self._defs=defs=split(line,'\t')
if not defs: raise ValueError, 'No column definitions'
if len(defs) != nv:
raise ValueError, (
line=file.readline()
line=line[:-1]
if line and line[-1:] in '\r\n': line=line[:-1]
fields=split(line,'\t')
l=len(fields)
nv=self._nv
if l != nv:
src/u/n/uniconvertor-HEAD/UniConvertor/trunk/uniconvertor/src/app/Graphics/font.py uniconvertor(Download)
# import os, re, operator from string import split, strip, atoi, atof, lower, translate, maketrans import streamfilter
def _bb(val):
return tuple(map(int, map(round, map(atof, split(strip(val))))))
def _number(val):
return int(round(atof(val)))
converters = {
line = afm.readline() if line == 'EndCharMetrics\n': break items = filter(None, map(strip, split(line, ';'))) if not items: continue code = name = width = bbox = None for item in items: [key, value] = split(item, None, 1)
elif key == 'N': name = value elif key == 'B': bbox = tuple(map(int,map(round,map(atof,split(value))))) charmetrics[name] = (width,) + bbox font_encoding[code] = name return charmetrics, font_encoding
if not line: break try: [key, value] = split(line, None, 1) except ValueError: # this normally means that a line contained only a keyword # but no value or that the line was empty
line = strip(line) if not line or line[0] == '#': continue info = map(intern, split(line, ',')) if len(info) == 6: psname = info[0] fontlist.append(tuple(info[:-1]))
src/m/y/mysql-python-HEAD/ZMySQLDA/lib/python/Products/ZMySQLDA/db.py mysql-python(Download)
from zLOG import LOG, ERROR, INFO
import string, sys
from string import strip, split, find, upper, rfind
from time import time
key_types = {
def _parse_connection_string(self, connection):
kwargs = {'conv': self.conv}
items = split(connection)
self._use_TM = None
if _mysql.get_client_info()[0] >= '5':
kwargs['client_flag'] = CLIENT.MULTI_STATEMENTS
if not items: return kwargs
self._mysql_lock = None
db_host = lockreq
if '@' in db_host:
db, host = split(db_host,'@',1)
kwargs['db'] = db
if ':' in host:
host, port = split(host,':',1)
if Default: info['Default'] = Default
if '(' in Type:
end = rfind(Type,')')
short_type, size = split(Type[:end],'(',1)
if short_type not in ('set','enum'):
if ',' in size:
info['Scale'], info['Precision'] = \
map(int, split(size,',',1))
db=self.db
try:
self._lock.acquire()
for qs in filter(None, map(strip,split(query_string, '\0'))):
qtype = upper(split(qs, None, 1)[0])
if qtype == "SELECT" and max_rows:
qs = "%s LIMIT %d" % (qs,max_rows)
src/u/n/uniconvertor-HEAD/UniConvertor/trunk/uniconvertor/src/app/Lib/dscparser.py uniconvertor(Download)
# import re, string from string import split, strip, atof import streamfilter
if value != ATEND: # the bounding box should be given in UINTs # but may also (incorrectly) be float. info.BoundingBox = tuple(map(atof, split(value))) else: info.atend = 1 elif key == 'DocumentNeededResources': if value != ATEND: if value: [type, value] = split(value, None, 1) if type == 'font': info.NeedResources(type, split(value))
info.atend = 1
elif key == 'DocumentNeededFonts':
if value != ATEND:
info.NeedResources('font', split(value))
else:
info.atend = 1
elif key == 'DocumentSuppliedResources':
if value != ATEND:
if value:
[type, value] = split(value, None, 1)
if type == 'font':
info.NeedResources(type, split(value))
# skip embedded document skip_to_comment(file, 'EndDocument') elif key == 'BeginData': value = split(strip(line[match.end(0):])) lines = 0 if len(value) >= 1: count = atoi(value)
src/i/r/ironruby-HEAD/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/pydoc.py ironruby(Download)
import sys, imp, os, re, types, inspect, __builtin__, pkgutil
from repr import Repr
from string import expandtabs, find, join, lower, split, strip, rfind, rstrip
from traceback import extract_tb
try:
from collections import deque
def splitdoc(doc):
"""Split a doc string into a synopsis line (if any) and the rest."""
lines = split(strip(doc), '\n')
if len(lines) == 1:
return lines[0], ''
elif len(lines) >= 2 and not rstrip(lines[1]):
return lines[0], join(lines[2:], '\n')
def replace(text, *pairs):
"""Do a series of global replacements on a string."""
while pairs:
text = join(split(text, pairs[0]), pairs[1])
pairs = pairs[2:]
return text
while not strip(line):
line = file.readline()
if not line: break
result = strip(split(line, '"""')[0])
else: result = None
return result
else:
# Some other error occurred during the importing process.
raise ErrorDuringImport(path, sys.exc_info())
for part in split(path, '.')[1:]:
try: module = getattr(module, part)
except AttributeError: return None
return module
def repr1(self, x, level):
if hasattr(type(x), '__name__'):
methodname = 'repr_' + join(split(type(x).__name__), '_')
if hasattr(self, methodname):
return getattr(self, methodname)(x, level)
return self.escape(cram(stripid(repr(x)), self.maxother))
all = object.__all__
except AttributeError:
all = None
parts = split(name, '.')
links = []
for i in range(len(parts)-1):
links.append(
def repr1(self, x, level):
if hasattr(type(x), '__name__'):
methodname = 'repr_' + join(split(type(x).__name__), '_')
if hasattr(self, methodname):
return getattr(self, methodname)(x, level)
return cram(stripid(repr(x)), self.maxother)
def indent(self, text, prefix=' '):
"""Indent text by prepending a given prefix to each line."""
if not text: return ''
lines = split(text, '\n')
lines = map(lambda line, prefix=prefix: prefix + line, lines)
if lines: lines[-1] = rstrip(lines[-1])
return join(lines, '\n')
def ttypager(text):
"""Page through text on a text terminal."""
lines = split(plain(text), '\n')
try:
import tty
fd = sys.stdin.fileno()
old = tty.tcgetattr(fd)
def locate(path, forceload=0):
"""Locate an object by name or dotted path, importing as necessary."""
parts = [part for part in split(path, '.') if part]
module, n = None, 0
while n < len(parts):
nextmodule = safeimport(join(parts[:n+1], '.'), forceload)
if nextmodule: module, n = nextmodule, n + 1
elif request == 'topics': self.listtopics()
elif request == 'modules': self.listmodules()
elif request[:8] == 'modules ':
self.listmodules(split(request)[1])
elif request in self.symbols: self.showsymbol(request)
elif request in self.keywords: self.showtopic(request)
elif request in self.topics: self.showtopic(request)
import StringIO, formatter
buffer = StringIO.StringIO()
formatter.DumbWriter(buffer).send_flowing_data(
'Related help topics: ' + join(split(xrefs), ', ') + '\n')
self.output.write('\n%s\n' % buffer.getvalue())
def showsymbol(self, symbol):
if key is None:
callback(None, modname, '')
else:
desc = split(__import__(modname).__doc__ or '', '\n')[0]
if find(lower(modname + ' - ' + desc), key) >= 0:
callback(None, modname, desc)
def goto(self, event=None):
selection = self.result_lst.curselection()
if selection:
modname = split(self.result_lst.get(selection[0]))[0]
self.open(url=self.server.url + modname + '.html')
def collapse(self):
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next