http://blog.csdn.net/pipisorry/article/details/52454579

IO模块

  • 16.2. io — Core tools for working with streams

    • 16.2.1. Overview

      • 16.2.1.1. Text I/O
      • 16.2.1.2. Binary I/O
      • 16.2.1.3. Raw I/O
    • 16.2.2. High-level Module Interface
      • 16.2.2.1. In-memory streams
    • 16.2.3. Class hierarchy
      • 16.2.3.1. I/O Base Classes
      • 16.2.3.2. Raw File I/O
      • 16.2.3.3. Buffered Streams
      • 16.2.3.4. Text I/O
    • 16.2.4. Performance
      • 16.2.4.1. Binary I/O
      • 16.2.4.2. Text I/O
      • 16.2.4.3. Multi-threading
      • 16.2.4.4. Reentrancy

python使用字符串构建stdin对象

{不知道有没有其它更好的方法}

python直接在代码中读入字符串到stdin中

import sys, io, resys.stdin = io.StringIO('''4,6
8 9 6 5
9,7
8,5
8,4
9,3
7,3
7,2
''')
a = []
while True:
    try:
        ai = input()a.append(ai)except:
        break
print(a)

或者input()一下就调用一下写好的程序!

Note: 如果是python2则字符串要是unicode,即io.StringIO(u'''*******''')

[ io.StringIO ( initial_value='', newline='\n' )]
[ io — Core tools for working with streams ]

皮皮Blog

其它模块

  • 16.4. argparse — Parser for command-line options, arguments and sub-commands

    • 16.4.1. Example

      • 16.4.1.1. Creating a parser
      • 16.4.1.2. Adding arguments
      • 16.4.1.3. Parsing arguments
    • 16.4.2. ArgumentParser objects
      • 16.4.2.1. prog
      • 16.4.2.2. usage
      • 16.4.2.3. description
      • 16.4.2.4. epilog
      • 16.4.2.5. parents
      • 16.4.2.6. formatter_class
      • 16.4.2.7. prefix_chars
      • 16.4.2.8. fromfile_prefix_chars
      • 16.4.2.9. argument_default
      • 16.4.2.10. allow_abbrev
      • 16.4.2.11. conflict_handler
      • 16.4.2.12. add_help
    • 16.4.3. The add_argument() method
      • 16.4.3.1. name or flags
      • 16.4.3.2. action
      • 16.4.3.3. nargs
      • 16.4.3.4. const
      • 16.4.3.5. default
      • 16.4.3.6. type
      • 16.4.3.7. choices
      • 16.4.3.8. required
      • 16.4.3.9. help
      • 16.4.3.10. metavar
      • 16.4.3.11. dest
      • 16.4.3.12. Action classes
    • 16.4.4. The parse_args() method
      • 16.4.4.1. Option value syntax
      • 16.4.4.2. Invalid arguments
      • 16.4.4.3. Arguments containing -
      • 16.4.4.4. Argument abbreviations (prefix matching)
      • 16.4.4.5. Beyond sys.argv
      • 16.4.4.6. The Namespace object
    • 16.4.5. Other utilities
      • 16.4.5.1. Sub-commands
      • 16.4.5.2. FileType objects
      • 16.4.5.3. Argument groups
      • 16.4.5.4. Mutual exclusion
      • 16.4.5.5. Parser defaults
      • 16.4.5.6. Printing help
      • 16.4.5.7. Partial parsing
      • 16.4.5.8. Customizing file parsing
      • 16.4.5.9. Exiting methods
    • 16.4.6. Upgrading optparse code
  • 16.5. getopt — C-style parser for command line options
  • 16.9. getpass — Portable password input
  • 16.10. curses — Terminal handling for character-cell displays
    • 16.10.1. Functions
    • 16.10.2. Window Objects
    • 16.10.3. Constants
  • 16.11. curses.textpad — Text input widget for curses programs
    • 16.11.1. Textbox objects
  • 16.12. curses.ascii — Utilities for ASCII characters
  • 16.13. curses.panel — A panel stack extension for curses
    • 16.13.1. Functions
    • 16.13.2. Panel Objects
  • 16.14. platform — Access to underlying platform’s identifying data
    • 16.14.1. Cross Platform
    • 16.14.2. Java Platform
    • 16.14.3. Windows Platform
      • 16.14.3.1. Win95/98 specific
    • 16.14.4. Mac OS Platform
    • 16.14.5. Unix Platforms
  • 16.15. errno — Standard errno system symbols
  • 16.16. ctypes — A foreign function library for Python
    • 16.16.1. ctypes tutorial

      • 16.16.1.1. Loading dynamic link libraries
      • 16.16.1.2. Accessing functions from loaded dlls
      • 16.16.1.3. Calling functions
      • 16.16.1.4. Fundamental data types
      • 16.16.1.5. Calling functions, continued
      • 16.16.1.6. Calling functions with your own custom data types
      • 16.16.1.7. Specifying the required argument types (function prototypes)
      • 16.16.1.8. Return types
      • 16.16.1.9. Passing pointers (or: passing parameters by reference)
      • 16.16.1.10. Structures and unions
      • 16.16.1.11. Structure/union alignment and byte order
      • 16.16.1.12. Bit fields in structures and unions
      • 16.16.1.13. Arrays
      • 16.16.1.14. Pointers
      • 16.16.1.15. Type conversions
      • 16.16.1.16. Incomplete Types
      • 16.16.1.17. Callback functions
      • 16.16.1.18. Accessing values exported from dlls
      • 16.16.1.19. Surprises
      • 16.16.1.20. Variable-sized data types
    • 16.16.2. ctypes reference
      • 16.16.2.1. Finding shared libraries
      • 16.16.2.2. Loading shared libraries
      • 16.16.2.3. Foreign functions
      • 16.16.2.4. Function prototypes
      • 16.16.2.5. Utility functions
      • 16.16.2.6. Data types
      • 16.16.2.7. Fundamental data types
      • 16.16.2.8. Structured data types
      • 16.16.2.9. Arrays and pointers

皮皮Blog

from:  http://blog.csdn.net/pipisorry/article/details/52454579

ref: [16. Generic Operating System Services]

操作系统服务:其它模块相关推荐

  1. python3.7官网中文官网_通用操作系统服务

    ### 导航 - [索引](../genindex.xhtml "总目录") - [模块](../py-modindex.xhtml "Python 模块索引" ...

  2. python数据库操作之pymysql模块和sqlalchemy模块(项目必备)

    pymysql pymsql是Python中操作MySQL的模块,其使用方法和MySQLdb几乎相同. 1.下载安装 pip3 install pymysql 2.操作数据库 (1).执行sql #! ...

  3. python中excel制作成绩报表_python制作简单excel统计报表2之操作excel的模块openpyxl简单用法...

    python制作简单excel统计报表2之操作excel的模块openpyxl简单用法 # coding=utf-8 from openpyxl import Workbook, load_workb ...

  4. python的文件操作、模块操作、os模块、time、datatime模块以及模块的制作

    Day12新手小白学python 第十二节 python的文件操作.模块操作.os模块.time.datatime模块以及模块的制作 目录 Day12新手小白学python 前言 一.文件打开关闭 二 ...

  5. 自学Python第九天- 模块、包、编码、文件操作、OS 模块、打包

    自学Python第九天- 模块.包.编码.文件操作.OS 模块.打包 模块 导入模块 程序入口 包 编码 文件操作 打开或创建文件 常用的文件打开模式 边读边写 文件对象的常用方法 读写 CSV Ex ...

  6. python操作jira添加模块

    python操作jira添加模块 python操作jira 首先安装jira模块 导入jira模块 编写添加模块代码 获取当前项目的模块信息 从excel表读取信息 主方法中调用添加模块等方法 pyt ...

  7. Golang操作Excel的模块Excelize学习总结2-设置单元格数据

    Golang操作Excel的模块Excelize – 设置单元格的值 新建excel文件 excelize.NewFile() 获取当前活动的sheet页索引 func (f *File) GetAc ...

  8. 操作系统服务:logging日志记录模块

    许多应用程序中都会有日志模块,用于记录系统在运行过程中的一些关键信息,以便于对系统的运行状况进行跟踪. 在.NET平台中,有非常著名的第三方开源日志组件log4net,c++中,有人们熟悉的log4c ...

  9. Python Excel 操作 | xlrd+xlwt 模块笔记

    Python 的pandas模块使用xlrd作为读取 excel 文件的默认引擎.但是,xlrd在其最新版本(从 2.0.1 版本开始)中删除了对 xls 文件以外的任何文件的支持. xlsx fil ...

  10. Python操作Excel——win32com模块和xlrd+xlwt+xlutils组合

    今天,接到一个任务,要生成大约两百个excel文件,从2006年到2013年,每个月两个文件,这些文件中除了几个关于日期的单元格不同外,其他数据都相同,所以就想到可以用python写一个小脚本,自动生 ...

最新文章

  1. Struts2——学习(5):页面跳转
  2. 课堂上我们为什么不发言
  3. 安装xml2js出现npm ERR! code E404 npm ERR! 404 Not Found: event-stream@3.3.6
  4. canopen服务器协议,CANopen
  5. 【干货·课程】言有三的深度学习从入门到上线课程
  6. python 递归函数_让你Python到很爽的加速递归函数的装饰器
  7. 基于深度学习的医学图像分割综述
  8. U启动安装原版Win7系统教程
  9. cas .net 重定向循环_接口测试平台接入企业cas(一)
  10. 如何通过Python玩转小视频
  11. 当你感到迷茫焦虑时,请听听白岩松这个演讲
  12. WEB小知识学习集锦
  13. (实用软件分享)屏幕取色器ColorPix
  14. Java 技术体系(JDK 与 JRE 的关系)、POJO 与 JavaBeans
  15. 黑马程序员入学基础测试(五)
  16. vb.net怎么和mysql连接_解析VB.NET如何连接数据库
  17. 检测到远端X服务正在运行中
  18. 教你高效修改文件夹名称,将首写字母改为大写
  19. 洛谷 P4233 射命丸文的笔记 题解
  20. linux查找以c开头的的文件夹,文件查找命令find详解

热门文章

  1. 如何用MyEclipse在Resin中调试Web应用程序
  2. 在ubuntu下使用搜狗的教育网代理
  3. 鸡肋 - cacheAsBitmap
  4. BZOJ 2431 [HAOI2009]逆序对数列 (dp)
  5. 测开之路五十三:unittest运行参数
  6. 面向接口的开发到面向对象的编程
  7. 事件代理与事件处理流程
  8. Bmob移动后端云服务平台--Android从零開始--(二)android高速入门
  9. oracl的使用命令
  10. mysql 大于小于不可在一个不等式中同时写