![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
一寸草
立足当下,眺望未来
展开
-
python基础语法
中文编码 在文件开头添加如下语句 #coding=utf-8 print "中文" python注释 单行注释使用 # name = '一寸草' #单行注释,定义一个字符串 #!/usr/bin/python # -*- coding: UTF-8 -*- # 文件名:test.py # 第一个注释 print "Hello, Python!"原创 2017-07-19 14:44:18 · 234 阅读 · 0 评论 -
Python String方法
string.capitalize() 首字母大写 string.center(num,str) #用str填充其余位置 num表示字符串有多少字符,str表示用于填充的字符串 name = 'helloworld' name.center(20,'a') >>aaaahelloworldaaaa string,counnt(str,start,end) #范围在转载 2017-07-20 09:18:10 · 412 阅读 · 0 评论