zoukankan      html  css  js  c++  java
  • 小结

    append() 方法用于在列表末尾添加新的对象。

    aList = [123, 'xyz', 'zara', 'abc'];
    aList.append( 2009 );
    print "Updated List : ", aList;
    输出:
    Updated List :  [123, 'xyz', 'zara', 'abc', 2009]


    pass:
    在编写代码时只写框架思路,具体实现还未编写就可以用 pass 进行占位,使程序不报错,不会进行任何操作。

    Python enumerate() 函数:

    enumerate() 函数用于将一个可遍历的数据对象(如列表、元组或字符串)组合为一个索引序列,同时列出数据和数据下标,一般用在 for 循环当中。

    Python 2.3. 以上版本可用,2.6 添加 start 参数。

    语法:

    enumerate(sequence, [start=0])

    参数

    
    
    • sequence -- 一个序列、迭代器或其他支持迭代对象。
    • start -- 下标起始位置。
    • 返回值

      返回 enumerate(枚举) 对象。

    • >>>seasons = ['Spring', 'Summer', 'Fall', 'Winter']
    • >>> list(enumerate(seasons))
    • [(0, 'Spring'), (1, 'Summer'), (2, 'Fall'), (3, 'Winter')]
    • >>> list(enumerate(seasons, start=1)) # 下标从 1 开始 [(1, 'Spring'), (2, 'Summer'), (3, 'Fall'), (4, 'Winter')]

    解决Spellchecker inspection helps locate typos and misspelling in your code

    idea出现这个是因为词库中没有这个单词,所以提示拼写错误 解决办法:双击下面有虚线的单词——>鼠标右键——>spelling——>save 'xxx' to distionary
     

    解决PEP 8: expected 2 blank lines, found 0

    https://jingyan.baidu.com/article/9080802237a606fd91c80f29.html

     
     
  • 相关阅读:
    Qt 去除控件边框线
    Qt 自定义可编辑 模型视图
    Qt double类型输出问题
    vue实例
    初识vue
    python中的数据类型
    python 列表解析式
    Goland常用快键键 mac pro
    文档对象模型DOM
    正则表达式
  • 原文地址:https://www.cnblogs.com/wuxiping2019/p/10647515.html
Copyright © 2011-2022 走看看