python - 使用 print() 截断长字符串
问题描述
我尝试了以下代码
s='Python is an interpreted high-level programming language for general-purpose programming. Created by Guido van Rossum and first released in 1991, Python has a design philosophy that emphasizes code readability, notably using significant whitespace. It provides constructs that enable clear programming on both small and large scales'
s1='Python features a dynamic type system and automatic memory management. It supports multiple programming paradigms, including object-oriented, imperative, functional and procedural, and has a large and comprehensive standard library'
print(s,end='\r')
print(s1)
我得到的输出是
Python is an interpreted high-level programming language for general-purpose programming. Created by Guido van Rossum and first released in 1991, Python has a design philosophy that emphasizes code readability, notably using significant whitespace. It provides con
Python features a dynamic type system and automatic memory management. It supports multiple programming paradigms, including object-oriented, imperative, functional and procedural, and has a large and comprehensive standard library
第一个字符串s
打印在两行上。\r
然后从第二行开始打印第二个字符串。
我希望从第一个字符串的开头打印第二个字符串。是否可以使用print
或应该使用任何其他功能?
解决方案
推荐阅读
- windows - 基于文件名移动文件的Powershell脚本
- xcode - Xcode/自定义按钮/对齐
- json - 将python从python2 env移植到python3 env时输出不匹配
- php - 创建联赛表 Wordpress 联赛存档插件
- php - PHPExcel:无法在 PHP 中打印动态行和列?
- javascript - 我可以在 React Jss 中使用破坏设置动态类名吗
- machine-learning - F1 分数是平衡数据集的一个很好的衡量标准吗
- python - 理解 Python Pandas 中的 groupby()
- javascript - 如何使用“BatchPutDocument”服务将文件上传到 S3 存储桶?
- javascript - 可访问的可折叠区域(无按钮)