Python built-in data operations (1) --- string str, pythonstr
S. capitalize ()-> str Return a capitalized version of S, I. e. make the first character have upper case and the rest lower case.Returns an upper-case string that converts the first
first, the number is 0.
If you want to automatically generate a number, automatically generate a number, such as the form of "d0000009", "d0000027", then you will face a problem, how to use the left 0 to make such a 8-digit code? I think of two
One, the number is 0.
If you want to automatically generate a number, automatically generate So-and-so number, like this form of "d0000009", "d0000027", then you will face a problem, how to the left with 0 to make up the 8-digit code? I think of
Copy CodeThe code is as follows:
$sourceNumber = "1";$newNumber = substr (Strval ($sourceNumber +1000), 1, 3);echo "$newNumber";?>
This time it will appear: 001
If you want to increase the number of digits, you can increase the 1000 and then
Copy CodeThe code is as follows:
$sourceNumber = "1";
$newNumber = substr (Strval ($sourceNumber +1000), 1, 3);
echo "$newNumber";
?>
This time it will appear: 001
If you want to increase the number of digits, you can increase the 1000 and then
1. Add 0 to the number.
If you want to automatically generate a student ID and automatically generate a student ID, such as "d0000009" and "d0000027", you will face a problem, how can we merge the left side with 0 into such 8-digit encoding? I have
PHP numbers are automatically filled with 0 on the left. Copy the code as follows :? Php $ sourceNumber1; $ newNumbersubstr (strval ($ sourceNumber + 1000), 1, 3); echo $ newNumber ;? In this case, 001 appears. if you want to increase the number of
The list of hive pre-defined UDF functions is as follows, mainly from the translation of describe function XXX and code Annotations :)
ABS (x)-returns the absolute value of X
ACOs (x)-returns the arc cosine of X if-1
ASCII (STR)-returns the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.