Created
June 28, 2018 11:57
-
-
Save Fhernd/aa5108ef6705a2dbe6b68cbc4a7b6295 to your computer and use it in GitHub Desktop.
Escritura y lectura de un archivo de texto. OrtizOL.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random as rnd | |
# Escritura sobre un archivo de texto: | |
with open('python.txt', 'w', encoding='utf-8') as f: | |
for idx in range(1, 11): | |
f.write('{}\n'.format(idx)) | |
# Lectura del archivo de texto: | |
with open('python.txt', 'r', encoding='utf-8') as f: | |
for linea in f: | |
print(linea, end='') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment