Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2015
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. # coding: utf-8
  2.  
  3. # print_textos.py
  4.  
  5. import sys
  6.  
  7.  
  8. # Aqui eu converto do utf-8 para unicode e depois para latin1 ou cp850
  9. # Se fizer direto, ele tentará usar a tabela ascii e dai...
  10. texto = "Olá code page 1252!".decode("utf-8").encode('latin1')
  11. texto2 = "Olá code page 850!".decode("utf-8").encode('cp850')
  12.  
  13. # Print comum
  14. print texto
  15. print texto2
  16.  
  17. print '--------------'
  18.  
  19. # Usando stdout
  20. sys.stdout.write(texto + "\n")
  21. sys.stdout.write(texto2 + "\n")
  22. sys.stdout.flush()
  23.  
  24. sys.exit(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement