I want to take a part of the character string
Reference http://www.mwsoft.jp/programming/python/str.html#substring Related http://qiita.com/7of9/items/62051d106c031e0f5b96
https://ideone.com/DpzMwn
serial="123456789012345678901234567890"
print "{0}", serial
print "{0:5>9}", serial
print "{0}", serial[5:10]
print "{0}", serial[5:-1]
result
Success time: 0.01 memory: 8968 signal:0
{0} 123456789012345678901234567890
{0:5>9} 123456789012345678901234567890
{0} 67890
{0} 678901234567890123456789
Is "{0}" unnecessary before?
I was thinking of using the Pi Zero serial number as a unique number, but I started to think that keeping all the characters was a security issue. If you make it a part of the character string, you can avoid the collision of numbers to some extent, and it seems that you can use it as a unique number.
Recommended Posts