current position:Home>Python separates strings by length, and if not enough, 0 is added
Python separates strings by length, and if not enough, 0 is added
2022-07-25 10:14:37【Wendianfei】
For example, install string 8 Separate them in groups and print them
#!/usr/bin/python
#-*- coding:utf-8 -*-
in_str = raw_input()
if len(in_str) % 8 == 0:
time = len(in_str) // 8
for i in range(time):
print in_str[i*8:i*8+8]
else:
time = len(in_str) // 8
for i in range(time):
print in_str[i*8:i*8+8]
print in_str[time*8:]+"0"*(8-(len(in_str) % 8))
copyright notice
author[Wendianfei],Please bring the original link to reprint, thank you.
https://en.pythonmana.com/2022/206/202207250923073232.html
The sidebar is recommended
- Python strings and lists
- Matplotlib foundation of Python visualization
- Python keyword
- Python(3)
- Python image processing -- three operation modes to realize image morphological transformation
- [Python cold knowledge you don't know] unpack the sequence / add an asterisk before the list *list
- [Python cold knowledge you don't know]__ all__ Role of / module import
- [recommended] 10 easy-to-use Python integrated development environments!
- Simple Python problem
- [Python crawler practice] use selenium to climb a music song and comment information~
guess what you like
[Python crawler series] have a taste of 40 practical tutorials of crawlers + source code [Basic + Advanced]
[Python reptile practice] it's too awesome to produce novels and only work as a website Porter ~ (source code attached)
Python multithreaded sub threads' disappear 'for no reason
Python's web crawler
Offline installation of Python paramiko module on Linux
Is there any scheme for user-defined data monitoring, such as whether the exception information thrown by my Python can be output to the alarm?
Python sum can be directly passed into the list derivation
Python machine learning 15 - detailed usage of xgboost and lightgbm (cross validation, grid search parameters, variable filtering)
012 Python data structure and algorithm: linked list
013 Python data structure and algorithm: bidirectional linked list
Random recommended
- 014 Python data structure and algorithm: stack and queue
- 018 Python data structure and algorithm: merge sort / binary search
- Column diagram 5 of Python drawing learning
- Python drawing learning column chart 6
- Python drawing learning column chart 7
- Seaborn of Python drawing histogram
- Seaborn of Python's box drawing
- Seaborn of Python drawing scattergram
- Seaborn of Python drawing violin
- Seaborn of Python drawing kernel density estimation graph
- Python drawing heat map Seaborn
- Pairplot function in Python visual exploration of the relationship between data features Seaborn
- Seaborn of Python drawing column graph
- Python draw Wayne diagram
- Seaborn of Python line drawing
- How to judge whether an element exists in selenium in Python syntax?
- [Python PIP special usage] PIP install -v -e. command details
- [artificial intelligence] machine learning and intelligent data processing Python uses naive Bayesian algorithm to classify spam message data sets
- Django4.0 + web + MySQL 5.7 realize simple login operation
- [Python] modules and packages
- Xiao Li: "is there a particularly simple case of Python decrypting RSA?" "Really."
- Create a visual GUI interface with Python, and realize various styles of photo processing with one click
- Mecol Studio - the sixth training of Django
- Simple usage of Python @
- Python of__ doc__
- How to use Python to batch import all data in Excel tables into SQL server specified tables?
- Install python3.8 for Ubuntu
- Python string depth summary
- Goodbye datetime! This Python date library is amazing!
- Python image processing -- three operation modes to realize image morphological transformation
- About the problem that the front-end video tag video cannot drag the progress bar fast forward (Django)
- Sequence data structures commonly used in Python
- On the drawing toolkit in Python
- Pandas - create data structures and basic attributes, sorting
- The use and difference of Python apply (), applymap (), map ()
- Pandas - detailed usage of groupby(), append, insert
- Python interacts with MySQL
- Processes in Python
- Threads in Python
- Summary of dictionary method of Python I