sirius's python study notes (1)

黄舟
Release: 2016-12-20 16:50:29
Original
1594 people have browsed it

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)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!