# -*- coding: cp936 -*-
#python 27
#xiaodeng >>> help(base64) #用来作base64编码解码
FUNCTIONS #函数(功能)
•b16decode(s, casefold=False)
Decode a Base16 encoded string.

      #解码
      decode_string=base64.b16decode('7869616F64656E67')
      print decode_string#xiaodeng

    •b16encode(s)
Encode a string using Base16.

      #编码
      string=base64.b16encode('xiaodeng')
      print string#7869616F64656E67

        s is the string to encode.  The encoded string is returned.

    •b32decode(s, casefold=False, map01=None)
Decode a Base32 encoded string.

      #decode_string=base64.b32decode('PBUWC33EMVXGO===')
      #print decode_string#xiaodeng

    •b32encode(s)
Encode a string using Base32.

      #string=base64.b32encode('xiaodeng')#PBUWC33EMVXGO===

        s is the string to encode.  The encoded string is returned.

    •b64decode(s, altchars=None)
Decode a Base64 encoded string.

      #64位解码
      #decode_string=base64.b64decode('eGlhb2Rlbmc=')##xiaodeng

        s is the string to decode.  Optional altchars must be a string of at least
length 2 (additional characters are ignored) which specifies the
alternative alphabet used instead of the '+' and '/' characters. The decoded string is returned. A TypeError is raised if s were
incorrectly padded or if there are non-alphabet characters present in the
string. •b64encode(s, altchars=None)
Encode a string using Base64.

      #64位编码
      #string=base64.b64encode('xiaodeng')#eGlhb2Rlbmc=

        s is the string to encode.  Optional altchars must be a string of at least
length 2 (additional characters are ignored) which specifies an
alternative alphabet for the '+' and '/' characters. This allows an
application to e.g. generate url or filesystem safe Base64 strings. The encoded string is returned.
  •decode(input, output) 
     Decode a file.#解码一个文件

   •encode(input, output)
      Encode a file.#编码一个文件

    •decodestring(s)#用来解码字符串
Decode a string.

      #>>> base64.decodestring('xiaodeng')
      #'\xc6&\xa8u\xe9\xe0'

    •encodestring(s)#用来编码字符串  

      #>>> base64.encodestring('\xc6&\xa8u\xe9\xe0')
      #'xiaodeng\n'

    standard_b64decode(s)
Decode a string encoded with the standard Base64 alphabet. s is the string to decode. The decoded string is returned. A TypeError
is raised if the string is incorrectly padded or if there are non-alphabet
characters present in the string. standard_b64encode(s)
Encode a string using the standard Base64 alphabet. s is the string to encode. The encoded string is returned. urlsafe_b64decode(s)
Decode a string encoded with the standard Base64 alphabet. s is the string to decode. The decoded string is returned. A TypeError
is raised if the string is incorrectly padded or if there are non-alphabet
characters present in the string. The alphabet uses '-' instead of '+' and '_' instead of '/'. urlsafe_b64encode(s)
Encode a string using a url-safe Base64 alphabet. s is the string to encode. The encoded string is returned. The alphabet
uses '-' instead of '+' and '_' instead of '/'.

最新文章

  1. MICAPS数据文件格式
  2. js中,全局变量与直接添加在window属性的区别
  3. 关于实现Extjs动态加载类的方式实现
  4. 什么是P3O?
  5. Nivo Slider - 世界上最棒的 jQuery 图片轮播插件
  6. 关于Ajax中http协议
  7. flask笔记---url、变量规则
  8. JVM学习笔记(三)------内存管理和垃圾回收
  9. Python之路【第十三篇】:jQuery -暂无内容-待更新
  10. linux下的磁盘挂载
  11. JavaTCP和UDP套接字编程
  12. 强化学习(四)用蒙特卡罗法(MC)求解
  13. Ubuntu16.04下ZeroC ICE的安装与使用示例(Qt C++ 和 Java)
  14. Flink 报错 "Could not find a suitable table factory for 'org.apache.flink.table.factories.StreamTableSourceFactory' in the classpath"
  15. [JS] ECMAScript 6 - Class : compare with c#
  16. C#中常用的单词
  17. Django models模型(1)
  18. JAVA框架 Spring 入门
  19. 洛谷P3375KMP字符串匹配
  20. ConcurrentLinkedQueue

热门文章

  1. 【转】各种 NoSQL 的比较
  2. dockerfile介绍
  3. Chapter 6 -- Caches
  4. tensorflow报错屏蔽的方法
  5. Sharepoint2013 Report Service初探
  6. ajax hash缓存
  7. Android -- 在xml文件中定义drawable数组
  8. TCP/UDP常见端口
  9. 利用shell脚本批量提交网站404死链给百度
  10. 在java中像js那样处理json数据