社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Python

在Python中将\n用作普通字符串

obami • 3 年前 • 1414 次点击  

我正在用数字做一个字符串计算器。例如: 154 + 246 = 154246

因此,用户将输入一组数字,使用 \n .如你所知, \n 用于生成新行,但我需要使用at作为任何普通字符串。我需要使用 \n

代码:

num_list = []
# this function will add a number to the list
def ask_num():
    # ask for a number (we will make it a string so we can add comma and /n)
    num = input("Enter numbers: ")

    
# run the function for asking numbers
ask_num()
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/129236
 
1414 次点击  
文章 [ 3 ]  |  最新文章 3 年前