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

All Samples(99432)  |  Call(99432)  |  Derive(0)  |  Import(0)
open(name[, mode[, buffering]]) -> file object

Open a file using the file() type, returns a file object.  This is the
preferred way to open a file.  See file.__doc__ for further information.

src/c/o/Code-HEAD/DiveIntoPython3/examples/stdout.py   Code(Download)
        sys.stdout = self.out_old
 
print('A')
with open('out.log', mode='w', encoding='utf-8') as a_file, RedirectStdoutTo(a_file):
    print('B')
print('C')
 

src/c/o/Code-HEAD/DiveIntoPython3/examples/customserializer.py   Code(Download)
    entry['published'] = True
    entry['published_date'] = time.strptime('Fri Mar 27 22:20:42 2009')
 
    with open('entry.pickle', 'wb') as f:
        pickle.dump(entry, f)
 
    with open('entry.pickle', 'rb') as f:
        entry2 = pickle.load(f)
 
    print(entry == entry2)
    print(type(entry['tags']))
    print(type(entry2['tags']))
 
    with open('entry.json', 'w', encoding='utf-8') as f:
    with open('entry.json', 'w', encoding='utf-8') as f:
        json.dump(entry, f, default=to_json)
 
    with open('entry.json', 'r', encoding='utf-8') as f:
        entry2 = json.load(f, object_hook=from_json)
 
    print(entry == entry2)

src/p/y/pyzza-HEAD/examples/graph/_mkcolors.py   pyzza(Download)
with open('colorshemes.py', 'wt', encoding='utf-8') as output:
    output.write('@package("graph")\n')
    output.write('class Colors:\n')
    output.write('    def __init__(self):\n')
    output.write('        pass\n')
    output.write('    x11 = {\n')
    with open('/usr/share/X11/rgb.txt') as input:

src/p/y/pyzza-0.2.10/examples/graph/_mkcolors.py   pyzza(Download)
with open('colorshemes.py', 'wt', encoding='utf-8') as output:
    output.write('@package("graph")\n')
    output.write('class Colors:\n')
    output.write('    def __init__(self):\n')
    output.write('        pass\n')
    output.write('    x11 = {\n')
    with open('/usr/share/X11/rgb.txt') as input:

src/n/i/NiPy-OLD-HEAD/examples/neurospin/neurospy/Results.py   NiPy-OLD(Download)
    #                     nulls={})
 
    # Make HTML page 
    output = open(output_html_path, mode = "w")
    output.write("<html><head><title> Result Sheet for %s \
    </title></head><body><center>\n" % zmap_file_path)
    output.write("<h2> Results for %s</h2>\n" % zmap_file_path)

src/c/o/Code-HEAD/DiveIntoPython3/examples/plural6.py   Code(Download)
    def __init__(self):
        self.pattern_file = open(self.rules_filename, encoding='utf-8')
        self.cache = []
 
    def __iter__(self):
        self.cache_index = 0
        return self

src/c/o/Code-HEAD/DiveIntoPython3/examples/plural5.py   Code(Download)
def rules(rules_filename):
    with open(rules_filename, encoding='utf-8') as pattern_file:
        for line in pattern_file:
            pattern, search, replace = line.split(None, 3)
            yield build_match_and_apply_functions(pattern, search, replace)
 
def plural(noun, rules_filename='plural5-rules.txt'):

src/c/o/Code-HEAD/DiveIntoPython3/examples/plural4.py   Code(Download)
    return (matches_rule, apply_rule)
 
rules = []
with open('plural4-rules.txt', encoding='utf-8') as pattern_file:
    for line in pattern_file:
        pattern, search, replace = line.split(None, 3)
        rules.append(build_match_and_apply_functions(

src/c/o/Code-HEAD/DiveIntoPython3/examples/oneline.py   Code(Download)
line_number = 1
with open('examples/favorite-people.txt', encoding='utf-8') as a_file:
    for a_line in a_file:
        print('{:>4} {}'.format(line_number, a_line.rstrip()))
        line_number += 1
 

src/p/l/plplot-HEAD/trunk/examples/python/xw20.py   plplot(Download)
def read_img(fname):
 
    if (not os.path.exists(fname)):
        return [1,[],0,0,0]
 
    fp = open(fname, mode='rb')
 

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next