help me~!about base64

Diez B. Roggisch deets at nospam.web.de
Tue Dec 2 14:58:47 EST 2008


ylj798 at gmail.com schrieb:
> my code:
> −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
> import base64
> def deflashget(st):
>      if st.startswith('Flashget://'):
>          return base64.decodestring(st[len('Flashget://'):])[10:-10]
>      elif st.startswith('http://') or st.startswith('ftp://'):
>          return 'Flashget://' + base64.encodestring('[FLASHGET]' + st
> +'[FLASHGET]').replace('\n', '')
> 
> st='Flashget://
> W0ZMQVNIR0VUXWh0dHA6Ly9kb3duLnJub3ZlbC5jb20vYm9va3R4dC8zLzEzNjgyLzEzNjgyLnppcFtGTEFTSEdFVF0=&1064'
> print deflashget(st)
> −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
> it's run ,Eric gave me error,the error is "'module' object has no
> attribute 'decodestring'",
> what can I do? who can help me?

How is the file called that the above code is in? I *bet* it is called
base64.py, or has been called that way. Jerry had the same idea, however
you must make sure that the code he gave you is run from inside the
above module - because only then you'll have the same environment.
Python on the commandline isn't sufficient.

Diez



More information about the Python-list mailing list