当前位置:网站首页>How to turn a multi digit number into a digital list
How to turn a multi digit number into a digital list
2022-07-06 20:38:00 【huaMinPython】
n=19
Method 1:
1. First convert numbers into strings .str(n)
2. Then convert the string into a string list .list(str)
3. Finally, convert each element into int.【int(i) for i in list】
l=[int(i) for i in list(str(n))]
Method 2:
use map(int,【】) function
l=list(map(int,list(str(n))))
n=19
# Method 1
#l=[int(i) for i in list(str(n))]
# Method 2
l=list(map(int,list(str(n))))
print(l)
边栏推荐
- 逻辑是个好东西
- 2022 refrigeration and air conditioning equipment installation and repair examination contents and new version of refrigeration and air conditioning equipment installation and repair examination quest
- [DSP] [Part 1] start DSP learning
- OLED屏幕的使用
- C language operators
- 2110 summary of knowledge points and common problems in redis class
- [diy] self designed Microsoft makecode arcade, official open source software and hardware
- Solution to the 38th weekly match of acwing
- Initial experience of addresssanitizer Technology
- Jupyter launch didn't respond after Anaconda was installed & the web page was opened and ran without execution
猜你喜欢

Force deduction brush question - 98 Validate binary search tree

【微信小程序】运行机制和更新机制

Discussion on beegfs high availability mode

RT thread I2C tutorial

报错分析~csdn反弹shell报错

Case ① | host security construction: best practice of 3 levels and 11 capabilities

Implementation of packaging video into MP4 format and storing it in TF Card

【GET-4】
![[DIY]如何制作一款個性的收音機](/img/fc/a371322258131d1dc617ce18490baf.jpg)
[DIY]如何制作一款個性的收音機

Activiti global process monitors activitieventlistener to monitor different types of events, which is very convenient without configuring task monitoring in acitivit
随机推荐
2022 Guangdong Provincial Safety Officer C certificate third batch (full-time safety production management personnel) simulation examination and Guangdong Provincial Safety Officer C certificate third
5. 無線體內納米網:十大“可行嗎?”問題
Unity making plug-ins
C language operators
[wechat applet] operation mechanism and update mechanism
看过很多教程,却依然写不好一个程序,怎么破?
The mail command is used in combination with the pipeline command statement
2022 portal crane driver registration examination and portal crane driver examination materials
强化学习-学习笔记5 | AlphaGo
【每周一坑】输出三角形
Entity alignment two of knowledge map
7. Data permission annotation
Kubernetes learning summary (20) -- what is the relationship between kubernetes and microservices and containers?
【每周一坑】信息加密 +【解答】正整数分解质因数
C language games - minesweeping
Learn to punch in Web
Gui Gui programming (XIII) - event handling
[DSP] [Part 2] understand c6678 and create project
PowerPivot - DAX (first time)
Use of OLED screen