SHARE
TWEET

prorgramaN13.py

a guest Mar 20th, 2019 125 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. Created on Tue Mar 19 23:33:48 2019
  5.  
  6. @author: jhongesell
  7. """
  8.  
  9. # Fuente: http://elclubdelautodidacta.es/wp/tag/python/page/4/
  10. # Python: Aprendiendo a escribir
  11. # fichero = open('arreglo_N02_V01.txt')
  12. # fichero = open('arreglo_N02_V01.txt', 'rt')
  13. # fichero = open('arreglo_N02_V01.txt', 'r')
  14. fichero = open('arreglo_N02_V02.txt', 'w')
  15. print(type(fichero))
  16. # fichero.read()
  17. print(fichero.write('Serie: La casa de la pradera\nAÑo: ni lo recuero, \yo era pequeño\n\n¿La repondrán? '))
  18.  
  19.  
  20.  
  21. print(fichero.write('Quién sabe.'))
  22. fichero.close()
  23.  
  24. print('**********')
  25. a = ['Litio\n', 'Sodio\n', 'Potasio\n']
  26. fichero = open('prueba2.txt', 'w')
  27. for elemento in a:
  28.     print(fichero.write(elemento))
  29. fichero.close()
  30.  
  31. print('**********')
  32. b = ['Fluor', 'Cloro', 'Bromo', 'Iodo']
  33. fichero = open('prueba3.txt', 'w')
  34. for elemento in b:
  35.     print(fichero.write(elemento + '\n'))
  36. fichero.close()
  37.  
  38. print('**********')
  39. c = ['Fluor', 'Cloro', 'Bromo', 'Iodo']
  40. fichero = open('prueba4.txt', 'w')
  41. for elemento in c:
  42.     print(fichero.write('%s\n' % elemento))
  43. fichero.close()
  44.  
  45. print('**********')
  46. print(a)
  47. fichero = open('prueba5.txt', 'w')
  48. fichero.writelines(a)
  49. fichero.close()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top