百科问答小站 logo
百科问答小站 font logo



如何评价 Python 基础知识难度大吗? 第1页

  

user avatar   xiao-wu-ge-89-82 网友的相关建议: 
      

任何语言都是有单词组成句子,然后形成表达,计算机语言也不例外,对于Python基础,我觉得可以按照英语来学。当你把下面这些单词每个都记住的时候,Python基础基本也就会了。

在Python3中,最基础的是74个内置函数,通用的函数,还有有6个基准的的数据类型:Number(数字)String(字符串)List(列表)Tuple(元组)Set(集合)Dictionary(字典),每种类型有其固有的属性和方法,学会这六种数据类型及基础的方法,很多代码基本上都能看得懂,很多功能也都能实现了。要是实现面向百度编程到面向自己编程的转变,必须搞搞清楚这六大数据类型的属性和方法。

内置函数模块

       print(dir(__builtins__)) 'abs', 'all', 'any', 'ascii', 'bin', 'bool', 'breakpoint', 'bytearray', 'bytes', 'callable',  'cell_count', 'chr', 'classmethod', 'compile', 'complex', 'copyright', 'credits', 'debugcell',  'debugfile', 'delattr', 'dict', 'dir', 'display', 'divmod', 'enumerate', 'eval', 'exec',  'filter', 'float', 'format', 'frozenset', 'get_ipython', 'getattr', 'globals', 'hasattr',  'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len',  'license', 'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next', 'object', 'oct',  'open', 'ord', 'pow', 'print', 'property', 'range', 'repr', 'reversed', 'round', 'runcell',  'runfile', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple',  'type', 'vars', 'zip'     

字符串模块

       print(dir(str())) 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format',  'format_map', 'index', 'isalnum', 'isalpha', 'isascii', 'isdecimal', 'isdigit', 'isidentifier',  'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower',  'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit',  'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper',  'zfill'     

字典模块

       print(dir(dict())) 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update',  'values'     

集合模块:

       print(dir(dict())) 'add', 'clear', 'copy', 'difference', 'difference_update', 'discard', 'intersection',  'intersection_update', 'isdisjoint', 'issubset', 'issuperset', 'pop', 'remove',  'symmetric_difference', 'symmetric_difference_update', 'union', 'update'     

列表模块

       print(dir(list())) 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse',  'sort'     

元组模块

       print(dir(tuple())) 'count', 'index'     

数字模块

主要有两个模块的函数需要掌握,一个是math,一个是random

       import math print(dir(math)) 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'copysign', 'cos', 'cosh',  'degrees', 'e', 'erf', 'erfc', 'exp', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp',  'fsum', 'gamma', 'gcd', 'hypot', 'inf', 'isclose', 'isfinite', 'isinf', 'isnan', 'ldexp', 'lgamma',  'log', 'log10', 'log1p', 'log2', 'modf', 'nan', 'pi', 'pow', 'radians', 'remainder', 'sin', 'sinh',  'sqrt', 'tan', 'tanh', 'tau', 'trunc'     
       import random print(dir(random)) 'choice', 'choices', 'expovariate', 'gammavariate', 'gauss', 'getrandbits', 'getstate', 'lognormvariate',  'normalvariate', 'paretovariate', 'randint', 'random', 'randrange', 'sample', 'seed', 'setstate',  'shuffle', 'triangular', 'uniform', 'vonmisesvariate', 'weibullvariate'     


把上面所有的函数都实践并理解一遍,然后学一些函数、类、条件啥的,基本问题能解决了。然后再往深了学。第一个阶段基本上背诵加实践就可以。第二阶段,根据自己的方向,爬虫也好,算法也好,开发也好,单独补充下。




  

相关话题

  Python中for i in somelist,如果在for循环内改变somelist会发生什么? 
  Python 怎么二次封装一个系统函数? 
  新程序员如何向英文社区(如github)进阶? 
  创业公司如何能吸引一名优秀的 Python 开发者? 
  python中用isdigit函数判断是否为数字,但当输入为负数是不行?怎么解决? 
  站在 2020 年回看,如何评价 Python 2 到 3 的升级? 
  数据分析为什么常用Jupyter而不是直接使用Python脚本或Excel? 
  哪里能找到数字版的PDF资料书呢(非扫描版,类似word转的那样,可以复制鼠标选中的内容)? 
  Python 有哪些黑魔法? 
  我想学Python,结果买了Python3.4.3的书,可以在Python3.6.4上用吗? 

前一个讨论
有哪些由中国团队在顶刊发表的文章创造了巨大的社会经济效益?
下一个讨论
能用高等数学手段研究人文社科问题吗?





© 2025-05-30 - tinynew.org. All Rights Reserved.
© 2025-05-30 - tinynew.org. 保留所有权利