Home >Backend Development >Python Tutorial >sirius's python study notes (1)
1. You can simply judge whether a string is an integer value through the try...except statement, such as the routine
x = raw_input('>')
try:
PRint int(x)
except ValueError:
Return None
2. The append function can also be used to add tuples, as follows
x = ('1','2')
y= []
y.append(x)
print y
The result is: [('1','2')]
The above is the content of sirius's python study notes (1). For more related content, please pay attention to the PHP Chinese website (www.php.cn)!