用python 实现在不确定行数情况下多行输入方法

yipeiwu_com6年前Python基础

如下所示:

stopword = ''
str = ''
for line in iter(raw_input, stopword):
 str += line + '\n'
print(str)

以上这篇用python 实现在不确定行数情况下多行输入方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持【听图阁-专注于Python设计】。

相关文章

利用python计算windows全盘文件md5值的脚本

利用python计算windows全盘文件md5值的脚本

import hashlib import os import time import configparser import uuid def test_file_md5(fi...

python requests 测试代理ip是否生效

代码如下所示: import requests '''代理IP地址(高匿)''' proxy = { 'http': 'http://117.85.105.170:808',...

关于pytorch中全连接神经网络搭建两种模式详解

pytorch搭建神经网络是很简单明了的,这里介绍两种自己常用的搭建模式: import torch import torch.nn as nn first: class NN...

Python中在for循环中嵌套使用if和else语句的技巧

for...[if]...构建List (List comprehension) 1.简单的for...[if]...语句 Python中,for...[if]...语句一种简洁的构建L...

Python的Django框架中使用SQLAlchemy操作数据库的教程

零、SQLAlchemy是什么? SQLAlchemy的官网上写着它的介绍文字: SQLAlchemy is the Python SQL toolkit and Object Rela...