tarjeta SD#

cargar archivo()#

The loadfile(filename, buffer) method loads the named file. If the optional bytearray is None, then an empty file is created.

Parámetros

Descripción

Nombre del archivo

El nombre del archivo a leer.

buffer

Opcional. Un bytearray para leer el archivo.

Devuelve: Un bytearray con los datos del archivo.

# Read the file into new bytearray.
b = brain.sdcard.loadfile('MyTextFile.txt')

se inserta()#

The is_inserted() method returns the status of the SD Card.

Returns: True if an SD card is inserted into the brain. False if it is not.

tamaño de archivo()#

The filesize(filename) method returns the size in bytes of the named file.

Parámetros

Descripción

Nombre del archivo

El nombre del archivo a comprobar.

Devuelve: El tamaño del archivo en bytes.

guardar archivo()#

The savefile(filename, buffer) method saves a bytearray into a named file. If the optional bytearray is None, then an empty file is created.

Parámetros

Descripción

Nombre del archivo

El nombre del archivo a escribir.

buffer

Opcional. Un bytearray para escribir en el archivo.

Devuelve: El número de bytes escritos.

# Write the bytearray into a file.
brain.sdcard.savefile('MyTextFile.txt', bytearray("Hello "))

archivo adjunto()#

The appendfile(filename, buffer) method appends a bytearray into a named file. Append is used to add more data to an existing file.

Parámetros

Descripción

Nombre del archivo

El nombre del archivo a escribir.

buffer

Un bytearray para escribir en el archivo.

Devuelve: El número de bytes escritos.

# Append the bytearray into a file.
brain.sdcard.appendfile('MyTextFile.txt', bytearray("World "))

tamaño()#

The size(filename) method returns the size in bytes of the named file.

Parámetros

Descripción

Nombre del archivo

El nombre del archivo a comprobar.

Devuelve: El tamaño del archivo en bytes.

existe()#

The exists(filename) method checks to see if the named file exists on the sd card.

Parámetros

Descripción

Nombre del archivo

El nombre del archivo a comprobar.

Returns: True if file exists. False if it does not exist.