Forum Programmation.python PHP strip_tags sous Python ?
17
août
2005
Existe-t-il en Python une fonction simple et robuste équivalente au strip_tags du PHP (suppression des balises HTML dans un document HTML) ?
import sys, gtk, threading
def test(*args):
dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, "Plop")
dialog.run()
dialog.destroy()
def test_thread():
gtk.gdk.threads_enter()
test()
gtk.gdk.threads_leave()
def test_threaded(*args):
threading.Thread(target=test_thread).start()
gtk.gdk.threads_init()
w = gtk.Window(gtk.WINDOW_TOPLEVEL)
b1 = gtk.Button("gtk.Dialog dans le thread principal")
b2 = gtk.Button("gtk.Dialog dans un autre thread")
h = gtk.HButtonBox()
b1.connect("clicked", test)
b2.connect("clicked", test_threaded)
w.add(h)
h.pack_start(b1)
h.pack_start(b2)
w.show_all()
gtk.main()
Certain langage (…)
msg = "éèàç" print msgIl m'affichera correctement éèàç : Ok. Si je mets ceci :
liste = ["Bonjour", "éèàç"] print listeJe me retrouve avec cela :
['Bonjour', '\xc3\xa9\xc3\xa8\xc3\xa0\xc3\xa7']et ce, même si je mets :
# -*- coding: UTF-8 -*- au début de mon code :]
Que se passe-t-il docteur ?
Merci bcp de votre aide :]
import os import sys sys.path.append(os.getcwd()+'/modules_locaux') import module_local_1Cela me semble assez compliqué, de plus a cause du '/' je ne suis pas sur que cela marche sous windows qui utilise '\' pour séparer les répertoires. Existe-il une méthode plus simple? merci
#!/usr/bin/env python
# -*- coding: ISO-8859-15 -*-
# generated by wxGlade 0.4cvs on Wed Jun 15 16:02:52 2005
import wx
from OpenGL.GLU import *
from (…)
rangzen@liberte:~ $ python
Python 2.4.1 (#2, Mar 30 2005, 21:51:10)
[GCC 3.3.5 (Debian 1:3.3.5-8ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import sha
print sha.new("dede").hexdigest()
8e65e20d4b7140a2e6ed067933d596228e46d380
rangzen@liberte:~ $ echo "dede"|sha1sum
47fae561fe8701af0356cf8403442a7795d750fb -
rangzen@liberte:~ $ echo "a"|sha1sum
3f786850e387550fdab836ed7e6dc881de23001b -
rangzen@liberte:~ $ python
Python 2.4.1 (#2, Mar 30 2005, 21:51:10)
[GCC 3.3.5 (Debian 1:3.3.5-8ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import sha
print sha.new("a").hexdigest()
86f7e437faa5a7fce15d1ddcb9eaeaea377667b8