zoukankan      html  css  js  c++  java
  • , , ,f的简单使用,于描述。

    1.“回车”这个名词的来历。  

       关于“回车键”的来历,还得从机械英文打字机说起。在机械英文打字机上,有一个部件叫“字车”,每打一个字符(原为单词,但是个人觉得这里应该是字符),“字车”就前进一格。当打满一行字符后,打字者就得推动“字车”到起始位置,这时打字机会有两个动作响应:一是“字车”被归位,二是滚筒上卷一行,以便开始输入下一行,这个推动“字车”的动作叫“回车”。后来,在电动英文打字机上,人们增加了一个直接起“回车”作用的键。这个新增的键就被称为“回车键”。后来电脑的研制时也借用这个“回车”的概念。

    简单来说,回车就是会到顶头的位置。

    2.“换行”是一种操作或者动作。

      换行: 在电脑上,编辑软件中一般用于结束一行文字输入,并将光标移到下一行的行首的位置

        

    3.   转义字符“ ”,“ ”。

      f 换页(FF),将当前位置移到下页开头,对应的aciII码为012

       换行(LF),将当前位置移到下一行开头,对应的aciII码为010

       回车(CR),将当前位置移到本行开头,对应的aciII码为013

       水平制表(HT) 跑到下一个TAB位置,对应的aciII码为009

    下面简单的记录一些使用。

    # coding: utf8
    
    import re
    
    # 分别从
    ,
    ,f,	
    s = '''abc
    def
    ghifjkl	mno
    over'''
    
    with open('1.txt', 'w') as fl:
        fl.write(s)
    
    
    with open('1.txt', 'r') as fl:
        content = fl.read()
        print(content)
        print('repr output', repr(content))
        print(content.split())
    
    /usr/local/bin/python3.7 /Users/shijianzhong/study/test_r_t.py
    abc
    def
    ghi jkl    mno
    over
    repr output 'abc def ghix0cjkl mno over'
    ['abc', 'def', 'ghi', 'jkl', 'mno', 'over']

    Process finished with exit code 0

     在PyCharm里面运行出来的结果,f于 没有换行效果,但通过split是可以进行切割的。

    f通过非转义输出为x0c, 等同于

    In [29]: with open('1.txt', 'r') as fl: 
        ...:     content = fl.read() 
        ...:     print(content) 
        ...:     print('repr output', repr(content)) 
        ...:     print(content.split()) 
        ...:                                                                                
    abc
    def
    ghi
       jkl	mno
    over
    repr output 'abc
    def
    ghix0cjkl	mno
    over'
    ['abc', 'def', 'ghi', 'jkl', 'mno', 'over']
    

     这个是在mac环境下ipython shell下运行的输出。

    f的效果出现了,我下面来个更加直接的。

    In [30]: print('123f456f789')                                                         
    123
       456
          789
    

     终端下输出还是非常美观的。

    这个是通过Linux命令查看文件内容的输出:

    shijianzhongdeMacBook-Pro:study shijianzhong$ cat 1.txt 
    def
    ghi
       jkl	mno
    overshijianzhongdeMacBook-Pro:study shijianzhong$ more 1.txt 
    abc^Mdef
    ghi^Ljkl        mno
    over
    

    最后是我直接双击打开文件的显示:

    abc
    def
    ghijkl	mno
    over
    
  • 相关阅读:
    mount: error mounting /dev/root on /sysroot as ext3: Invalid argument
    redhat5.8 alt+ctrl+f1 黑屏
    Linux U盘 启动盘
    Debian For ARM Webmin Server
    Debian For ARM mysql-server install information
    fakeroot: preload library `libfakeroot.so' not found, aborting.
    FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
    JavaScript获取table中某一列的值的方法
    SpringMvc(注解)上传文件的简单例子
    SpringMVC单文件上传、多文件上传、文件列表显示、文件下载
  • 原文地址:https://www.cnblogs.com/sidianok/p/12078433.html
Copyright © 2011-2022 走看看