加载中…
个人资料
嘚嘚
嘚嘚
  • 博客等级:
  • 博客积分:0
  • 博客访问:743
  • 关注人气:24
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
博文
标签:

杂谈

分类: Python

python的内置函数可以直接调用,无需import。有很多

 

我在平时常用到的,

int()将字符串或者小数转换成整数

str()将其他类型转换是字符型

len(X)返回X的长度。The argument may be a sequence (string, tuple or list) or a mapping (dictionary).

print()输出

type(X)返回X的数据类型

open(f)打开一个文件f并返回文件类型的对象。 和file()相似。

 

在python2.7.2 doc中可以查到每个函数的详细用法。

 http://docs.python.org/library/functions.html

标签:

python

string

it

分类: Python
common string oprations
import string
1. string constants(常量)
1) string.ascii_letters
      The concatenation of the ascii_lowercase and ascii_uppercase constants described below. This value is not locale-dependent.
print string.ascii_letters
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
2) string.ascii_lowercase
     
The lowercase letters 'abcdefghijklmnopqrstuvwxy
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有