atom-community / atom-community/atom-script

Python3 open() opens in text mode regardless of option.

Open
#1,717 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
730
Forks
264
PR merge metrics
No merged PRs in 30d

Description

I was trying to open and manipulate the idx files from MNIST. I attempted to print out the first little bit of each file in the console, but found a jumbled mess.

#The code:
import os
here = os.getcwd()

#open
f = open(here+'/data/t10k-images.idx3-ubyte','rb')
contents = f.read(8)
print(type(contents))

prints in the console when run in Atom, but 'rb' should be read in binary mode. Running the same file from the terminal prints .

The files I'm working with can be found here: http://yann.lecun.com/exdb/mnist/ , but just working with plain .txt files yields the same results.

Atom 1.30.0
Script 3.18.1
Pop!_OS (ubuntu) 18.04

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.