Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
2847 connectés 

  FORUM HardWare.fr
  Programmation
  Python

  python et l'unicode : -U / python 3000 / repr ... [résolu]

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

python et l'unicode : -U / python 3000 / repr ... [résolu]

n°1546615
suizokukan
Posté le 22-04-2007 à 16:55:43  profilanswer
 

Bonjour,
 
j'ai quelques questions sur Python et l'unicode :
 
(1) pour forcer les chaînes à être de type 'unicode' (et non plus 'str') je lance en ligne de commande :
 

python -U


 
... pas de problème, ça fonctionne.
Mais dans un en-tête de fichier, comment faire ? L'exemple suivant ne marche pas (/usr/bin/env: python -U: Aucun fichier ou répertoire de ce type) :
 

Code :
  1. #! /usr/bin/env python -U
  2. # -*- coding: utf-8 -*-


 
(2) Je suis de loin en loin la venue de Python 3000, qui unifiera les types unicode/str en un type unique. Est-ce que vous savez quand la date de sortie est prévue [réponse donnée ici : http://www.artima.com/forums/flat. [...] ead=197203 : juin 2008]? Savez-vous si la fonction __repr__() pourra enfin renvoyer de l'unicode ?


Message édité par suizokukan le 24-04-2007 à 09:37:54

---------------
rule #1 : trust the python
mood
Publicité
Posté le 22-04-2007 à 16:55:43  profilanswer
 

n°1546623
masklinn
í dag viðrar vel til loftárása
Posté le 22-04-2007 à 17:10:28  profilanswer
 

Pour la question 2, probablement dans la mesure où le type string lui même sera de l'unicode :o


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?
n°1546626
suizokukan
Posté le 22-04-2007 à 17:19:33  profilanswer
 

En effet, Masklinn, ça me paraît aussi logique; et pour ma première question, ... ?

n°1546627
masklinn
í dag viðrar vel til loftárása
Posté le 22-04-2007 à 17:23:53  profilanswer
 

aucune idée sinon j'y aurais répondu :o


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?
n°1546632
suizokukan
Posté le 22-04-2007 à 17:48:43  profilanswer
 

Quelqu'un s'était déjà posé la question : http://mail.python.org/pipermail/p [...] 00698.html,
 mais n'a pas trouvé la réponse.
 
Dans tout ce que je lis, il semble bien qu'il soit impossible de passer un argument à 'env'.

n°1546645
masklinn
í dag viðrar vel til loftárása
Posté le 22-04-2007 à 18:40:53  profilanswer
 

Tu peux aliaser sinon, créer un python custom qui lance python -U :o
 
C'est un peu goret, mais ça marche :o


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?
n°1546648
suizokukan
Posté le 22-04-2007 à 18:47:18  profilanswer
 

Je suis arrivé à la même conclusion; ça marche bien
 
Juste une note : l'option -U n'est pas officielle et certaines bibliothèques ne l'apprécient pas (ex : xml.sax )
 
Merci à Masklinn de s'être penché sur mon problème !


---------------
rule #1 : trust the python

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Python

  python et l'unicode : -U / python 3000 / repr ... [résolu]

 

Sujets relatifs
Créer un batch pour redémarrer un programme [résolu][Résolu][C# .Net] Changer le curseur quand je pointe une image
[PHP][resolu] Comment appeler une fonction située....[non résolu] mysql- rechercher dans plusieurs tables
[MySql] Concatener deux champs [Resolu][RESOLU] Absence barre de defilement verticale sous Opera
Probléme avec une boucle for[Debutant] soucis pour consulter source site web[Résolu]
[Erreur python]underlying C/C++ object has been deleted [ Résolu ] 
Plus de sujets relatifs à : python et l'unicode : -U / python 3000 / repr ... [résolu]


Copyright © 1997-2025 Groupe LDLC (Signaler un contenu illicite / Données personnelles)