欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

sirius的python学习笔记(1)

程序员文章站 2022-06-01 08:04:10
...
1、可以通过try...except语句来简单的判断字符串是否为整数值,如例程

x = raw_input('>')

try:

PRint int(x)

except ValueError:

return None

2、append函数也可以用来添加tuple,如下

x = ('1','2')

y= []

y.append(x)

print y

结果为:[('1','2')]

以上就是sirius的python学习笔记(1)的内容,更多相关内容请关注PHP中文网(www.php.cn)!

相关标签: sirius python