• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(605)  |  Call(20)  |  Derive(0)  |  Import(585)
file(name[, mode[, buffering]]) -> file object

Open a file.  The mode can be 'r', 'w' or 'a' for reading (default),
writing or appending.  The file will be created if it doesn't exist
when opened for writing or appending; it will be truncated when
opened for writing.  Add a 'b' to the mode for binary files.
Add a '+' to the mode to allow simultaneous reading and writing.
If the buffering argument is given, 0 means unbuffered, 1 means line
buffered, and larger numbers specify the buffer size.  The preferred way
to open a file is with the builtin open() function.
Add a 'U' to mode to open the file for input with universal newline
support.  Any line ending in the input file will be seen as a '\n'
in Python.  Also, a file so opened gains the attribute 'newlines';
the value for this attribute is one of None (no newline read yet),
'\r', '\n', '\r\n' or a tuple containing all the newline types seen.

'U' cannot be combined with 'w' or '+' mode.

src/n/l/nlpy-HEAD/trunk/nlpy/NLPy/pyma57.py   nlpy(Download)
    M = spmatrix.ll_mat_from_mtx( sys.argv[1] )
    (m,n) = M.shape
    if m != n:
        sys.stderr( 'Matrix must be square' )
        sys.exit(1)
    if not M.issym:
        sys.stderr( 'Matrix must be symmetric' )

src/n/l/nlpy-HEAD/trunk/nlpy/NLPy/pyma27.py   nlpy(Download)
    M = spmatrix.ll_mat_from_mtx( sys.argv[1] )
    (m,n) = M.shape
    if m != n:
        sys.stderr( 'Matrix must be square' )
        sys.exit(1)
    if not M.issym:
        sys.stderr( 'Matrix must be symmetric' )

src/n/l/nlpy-HEAD/nlpy/NLPy/pyma57.py   nlpy(Download)
    M = spmatrix.ll_mat_from_mtx( sys.argv[1] )
    (m,n) = M.shape
    if m != n:
        sys.stderr( 'Matrix must be square' )
        sys.exit(1)
    if not M.issym:
        sys.stderr( 'Matrix must be symmetric' )

src/n/l/nlpy-HEAD/nlpy/NLPy/pyma27.py   nlpy(Download)
    M = spmatrix.ll_mat_from_mtx( sys.argv[1] )
    (m,n) = M.shape
    if m != n:
        sys.stderr( 'Matrix must be square' )
        sys.exit(1)
    if not M.issym:
        sys.stderr( 'Matrix must be symmetric' )

src/u/n/uniconvertor-HEAD/UniConvertor/trunk/uniconvertor/src/app/conf/configurator.py   uniconvertor(Download)
			try:
				os.mkdir(self.user_config_dir, 0777)
			except (IOError, os.error), value:
				sys.stderr('cannot write preferences into %s.' % user_config_dir)
				sys.exit(1)
		if not os.path.isdir(self.user_fonts):
			result = False
			file = open(filename, 'w')
		except (IOError, os.error), value:
			import sys
			sys.stderr('cannot write preferences into %s: %s'% (`filename`, value[1]))
			return
 
		writer = XMLGenerator(out=file,encoding=self.system_encoding)

src/m/l/mlboost-0.4.1/mlboost/core/ppdataset.py   mlboost(Download)
        elif fcount==1:
            return True
        else:
            sys.stderr("There is "+fcount+" fields")
            return True
 
    def Idx(self,fields):
    def FreqDist(self,field,minvalues=30,maxvalues=50,data=None,save=False,reset=True):
 
        if self.IsCategorical(field):
            sys.stderr(field+" isn't a continuous values. You can't call:"+sys._getframe().f_code.co_name)
            return self.GetDist(field)
 
        if reset:
def merge(dataset1,dataset2):
    if dataset1.header!=dataset2.header:
        sys.stderr(sys._getframe().f_code.co_name+": can't merge those 2 datasets !")
        return None
    nrec=dataset1.nrec+dataset2.nrec
    data=zeros((nrec,self.nfields))
    for i in range(dataset1.s):

src/s/p/spambayes-HEAD/trunk/spambayes/scripts/sb_mboxtrain.py   spambayes(Download)
            for line in outf.xreadlines():
                f.write(line)
        except:
            print >> sys.stderr ("Problem writing mbox!  Sorry, "
                                 "I tried my best, but your mail "
                                 "may be corrupted.")
            raise

src/s/p/spambayes-HEAD/spambayes/scripts/sb_mboxtrain.py   spambayes(Download)
            for line in outf.xreadlines():
                f.write(line)
        except:
            print >> sys.stderr ("Problem writing mbox!  Sorry, "
                                 "I tried my best, but your mail "
                                 "may be corrupted.")
            raise

src/s/i/signallab-HEAD/TRUNK/components/api/src/signal_lab.py   signallab(Download)
 
        _,suffix = os.path.splitext(fname)
        if suffix.lower() not in['.rsf','.h','.hh']:
            print >> sys.stderr(" warning RSF input does not conform to standard extension '.rsf' " )
 
        return fname
 

src/s/i/signal_lab-0.1/components/api/src/signal_lab.py   signal_lab(Download)
 
        _,suffix = os.path.splitext(fname)
        if suffix.lower() not in['.rsf','.h','.hh']:
            print >> sys.stderr(" warning RSF input does not conform to standard extension '.rsf' " )
 
        return fname
 

  1 | 2  Next