All Samples(5652) | Call(5256) | Derive(0) | Import(396)
strip(s [,chars]) -> string 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 unicode, S will be converted to unicode before stripping.
def strip(s, chars=None):
"""strip(s [,chars]) -> string
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 unicode, S will be converted to unicode before stripping.
"""
return s.strip(chars)
c = cPickle.load(open('100000.txt', 'rb'))
print 'abstract: ', string.strip(c.abstract)
print 'abstract_author: ', string.strip(c.abstract_author)
print 'address: ', string.strip(c.address)
print 'call_number: ', string.strip(c.call_number)
print 'class_update_date: ', string.strip(c.class_update_date)
print 'country: ', string.strip(c.country)
print 'english_abstract: ', string.strip(c.english_abstract)
print 'entry_date: ', string.strip(c.entry_date)
print 'entry_month: ', string.strip(c.entry_month)
print 'id: ', string.strip(c.id)
print 'issn: ', string.strip(c.issn)
print 'entry_month: ', string.strip(c.entry_month) print 'id: ', string.strip(c.id) print 'issn: ', string.strip(c.issn) print 'issue_part_supplement: ', string.strip(c.issue_part_supplement) print 'journal_title_code: ', string.strip(c.journal_title_code) print 'last_revision_date: ', string.strip(c.last_revision_date) print 'major_revision_date: ', string.strip(c.major_revision_date) print 'no_author: ', string.strip(c.no_author) print 'number_of_references: ', string.strip(c.number_of_references) print 'pagination: ', string.strip(c.pagination) print 'publication_date: ', string.strip(c.publication_date) print 'pubmed_id: ', string.strip(c.pubmed_id) print 'source: ', string.strip(c.source) print 'special_list: ', string.strip(c.special_list)
print 'pubmed_id: ', string.strip(c.pubmed_id) print 'source: ', string.strip(c.source) print 'special_list: ', string.strip(c.special_list) print 'title: ', string.strip(c.title) print 'title_abbreviation: ', string.strip(c.title_abbreviation) print 'transliterated_title: ', string.strip(c.transliterated_title) print 'volume_issue: ', string.strip(c.volume_issue) print 'year: ', string.strip(c.year)
src/p/y/pymol-HEAD/trunk/pymol/examples/cookbook/dali.py pymol(Download)
os.remove(filename)
from pymol import cmd
from string import strip
import os
seen = {}
if line[0:12]==' NR. STRID1':
input_state = 1
elif input_state == 1:
if strip(line)=='':
input_state = 2
elif line[4:5]==':':
trg = strip(line[6:12])
src = strip(line[13:19])
seen[src_code]=1
matrix = []
for a in range(0,3):
matrix.append(float(strip(line[29:38])))
matrix.append(float(strip(line[39:48])))
matrix.append(float(strip(line[49:58])))
matrix.append(float(strip(line[59:78])))
src/b/i/biopython-doc-ja-HEAD/old_doc_jp/examples/getgene.py biopython-doc-ja(Download)
def Get_Organism(self, id):
entry = self.Get(id)
if not entry: return None
for line in string.split(entry, '\n'):
if line[0:5] == 'OS ':
OS = string.strip(line[5:])
if OS[-1] ==".": OS = OS[0:-1]
def FixOS(self, os):
os = string.split(os,',')[0]
os = string.split(os,'(')[0]
return string.strip(os)
def Get_Taxonomy(self, id):
entry = self.Get(id)
if not entry: return None
OC = ""
for line in string.split(entry, '\n'):
if line[0:5] == 'OC ':
OC = OC + string.strip(line[5:])
def Get_Kingdom(self, id):
res = self.Get_Taxonomy(id)
#print id, res
if not res: return "U"
kd = string.strip(string.split(res,";")[0])
if kd == "Eubacteria" or kd == "Prokaryota" or kd == "Bacteria": return "B"
elif kd == "Eukaryota" or kd =="Eukaryotae": return "E"
def Get_Gene(self, id):
entry = self.Get(id)
if not entry: return None
GN = ''
for line in string.split(entry, '\n'):
if line[0:5] == 'GN ':
GN = string.strip(line[5:])
def Get_OS_OC_GN(self, id):
entry = self.Get(id)
if not entry: return None, None, None
OS, OC, GN = "","",""
for line in string.split(entry, '\n'):
if line[0:5] == 'OS ':
OS = string.strip(line[5:])
if OS[-1] ==".": OS = OS[0:-1]
if line[0:5] == 'OC ':
OC = OC + string.strip(line[5:])
if OC[-1] ==".": OC = OC[0:-1]
if line[0:5] == 'GN ':
GN = string.strip(line[5:])
def Get_OS_OC_OG(self, id):
entry = self.Get(id)
if not entry: return None, None, None
OS, OC, OG = "","",""
for line in string.split(entry, '\n'):
if line[0:5] == 'OS ':
OS = string.strip(line[5:])
if OS[-1] ==".": OS = OS[0:-1]
if line[0:5] == 'OC ':
OC = OC + string.strip(line[5:])
if OC[-1] ==".": OC = OC[0:-1]
if line[0:5] == 'OG ':
OG = string.strip(line[5:])
def Get_SQ(self, id, fasta = 1):
entry = self.Get(id)
if not entry: return ""
SQ = ""
record = 0
for line in string.split(entry, '\n'):
if record: SQ = SQ + string.strip(line[5:])
def Get_XX(self, id, xx):
entry = self.Get(id)
if not entry: return ""
XX = ""
for line in string.split(entry, '\n'):
if line[0:5] == '%s ' % xx:
XX = XX + string.strip(line[5:])
def Get_Keywords(self, id):
entry = self.Get(id)
if not entry: return []
keywords = []
for line in string.split(entry, '\n'):
if line[0:5] == 'KW ':
for i in string.split(string.strip(line[5:]),';'):
kw = string.strip(i)
src/p/y/pymol-HEAD/pymol/examples/cookbook/dali.py pymol(Download)
os.remove(filename)
from pymol import cmd
from string import strip
import os
seen = {}
if line[0:12]==' NR. STRID1':
input_state = 1
elif input_state == 1:
if strip(line)=='':
input_state = 2
elif line[4:5]==':':
trg = strip(line[6:12])
src = strip(line[13:19])
seen[src_code]=1
matrix = []
for a in range(0,3):
matrix.append(float(strip(line[29:38])))
matrix.append(float(strip(line[39:48])))
matrix.append(float(strip(line[49:58])))
matrix.append(float(strip(line[59:78])))
src/b/i/biopython-1.55/Doc/examples/getgene.py biopython(Download)
def Get_Organism(self, id):
entry = self.Get(id)
if not entry: return None
for line in string.split(entry, '\n'):
if line[0:5] == 'OS ':
OS = string.strip(line[5:])
if OS[-1] ==".": OS = OS[0:-1]
def FixOS(self, os):
os = string.split(os,',')[0]
os = string.split(os,'(')[0]
return string.strip(os)
def Get_Taxonomy(self, id):
entry = self.Get(id)
if not entry: return None
OC = ""
for line in string.split(entry, '\n'):
if line[0:5] == 'OC ':
OC = OC + string.strip(line[5:])
def Get_Kingdom(self, id):
res = self.Get_Taxonomy(id)
#print id, res
if not res: return "U"
kd = string.strip(string.split(res,";")[0])
if kd == "Eubacteria" or kd == "Prokaryota" or kd == "Bacteria": return "B"
elif kd == "Eukaryota" or kd =="Eukaryotae": return "E"
def Get_Gene(self, id):
entry = self.Get(id)
if not entry: return None
GN = ''
for line in string.split(entry, '\n'):
if line[0:5] == 'GN ':
GN = string.strip(line[5:])
def Get_OS_OC_GN(self, id):
entry = self.Get(id)
if not entry: return None, None, None
OS, OC, GN = "","",""
for line in string.split(entry, '\n'):
if line[0:5] == 'OS ':
OS = string.strip(line[5:])
if OS[-1] ==".": OS = OS[0:-1]
if line[0:5] == 'OC ':
OC = OC + string.strip(line[5:])
if OC[-1] ==".": OC = OC[0:-1]
if line[0:5] == 'GN ':
GN = string.strip(line[5:])
def Get_OS_OC_OG(self, id):
entry = self.Get(id)
if not entry: return None, None, None
OS, OC, OG = "","",""
for line in string.split(entry, '\n'):
if line[0:5] == 'OS ':
OS = string.strip(line[5:])
if OS[-1] ==".": OS = OS[0:-1]
if line[0:5] == 'OC ':
OC = OC + string.strip(line[5:])
if OC[-1] ==".": OC = OC[0:-1]
if line[0:5] == 'OG ':
OG = string.strip(line[5:])
def Get_SQ(self, id, fasta = 1):
entry = self.Get(id)
if not entry: return ""
SQ = ""
record = 0
for line in string.split(entry, '\n'):
if record: SQ = SQ + string.strip(line[5:])
def Get_XX(self, id, xx):
entry = self.Get(id)
if not entry: return ""
XX = ""
for line in string.split(entry, '\n'):
if line[0:5] == '%s ' % xx:
XX = XX + string.strip(line[5:])
def Get_Keywords(self, id):
entry = self.Get(id)
if not entry: return []
keywords = []
for line in string.split(entry, '\n'):
if line[0:5] == 'KW ':
for i in string.split(string.strip(line[5:]),';'):
kw = string.strip(i)
src/c/l/clearsilver-0.10.1/clearsilver/python/examples/base/wordwrap.py clearsilver(Download)
else:
j = ltext
body.append(string.strip(text[i:j]))
i = j+1
if is_header:
src/p/r/productiontrack-HEAD/pt1/tools/reportlab/graphics/samples/runall.py productiontrack(Download)
def run(format, VERBOSE=0):
formats = string.split(format, ',')
for i in range(0, len(formats)):
formats[i] == string.lower(string.strip(formats[i]))
allfiles = glob.glob('*.py')
allfiles.sort()
for fn in allfiles:
src/c/l/clearsilver-0.10.1/clearsilver/python/examples/trans/trans.py clearsilver(Download)
def cleanHtmlString(self, s):
s = re.sub("\s+", " ", s)
return string.strip(s)
def containsWords(self, s, ishtml):
if ishtml:
s = string.replace(s, ' ', ' ')
seen_hdf = {}
for fname, strings in results:
for (s, ofs, ishtml) in strings:
if s and string.strip(s):
l = len(s)
if ishtml:
s = self.cleanHtmlString(s)
src/p/r/productiontrack-HEAD/tools/reportlab/graphics/samples/runall.py productiontrack(Download)
def run(format, VERBOSE=0):
formats = string.split(format, ',')
for i in range(0, len(formats)):
formats[i] == string.lower(string.strip(formats[i]))
allfiles = glob.glob('*.py')
allfiles.sort()
for fn in allfiles:
src/d/i/digest-HEAD/lib/reportlab/graphics/samples/runall.py digest(Download)
def run(format, VERBOSE=0):
formats = string.split(format, ',')
for i in range(0, len(formats)):
formats[i] == string.lower(string.strip(formats[i]))
allfiles = glob.glob('*.py')
allfiles.sort()
for fn in allfiles:
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next