社区所有版块导航
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

for循环中的Python打印格式

Mohammad Hassani • 3 年前 • 1320 次点击  
*if menuInput == '1':
     print("")
     encryptString = input("Please enter string to encrypt:")
     print("")
     offSetValue = int(input("Please enter offset value (1-94):"))
     print("")
 
     for character in encryptString:
         x = ord(character)
         y = x + offSetValue
         z = chr(y)      
         print("Encrypted string:") 
         print(z)*

我希望已加密的字符串以以下格式输出:

加密字符串:

abcde 

但它是以这种形式出现的:

Encrypted string: 
a
Encrypted string: 
b
Encrypted string: 
c
Encrypted string: 
d

我试过使用end和sep,但都没有用。

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/132756
 
1320 次点击  
文章 [ 3 ]  |  最新文章 3 年前