9q13nh 发表于 2024-8-17 09:20:24

python与其他编程语言区别全在这


    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"> <span style="color: black;">针对</span>接触过编程语言的人<span style="color: black;">来讲</span>,<span style="color: black;">倘若</span>要快速上手python,<span style="color: black;">首要</span>要<span style="color: black;">认识</span>python和其他编程语言的<span style="color: black;">重点</span>区别在哪?下边勇哥<span style="color: black;">重点</span>以<span style="color: black;">运用</span>较多的JAVA和C语言来做对比。<span style="color: black;">爱好</span>的话,<span style="color: black;">期盼</span><span style="color: black;">大众</span>关注<span style="color: black;">咱们</span>,<span style="color: black;">咱们</span>会<span style="color: black;">连续</span>推出高质量的<span style="color: black;">文案</span>和视频来回馈<span style="color: black;">大众</span>。</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">区别一:</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">python程序的每条语句结尾不<span style="color: black;">必须</span>分号,而JAVA和C语言的语句结尾<span style="color: black;">必须</span>分号。</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">区别二:</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">python是靠缩进来划分语句块,而C语言和JAVA是靠大括号来划分语句块。</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">例如下述python代码块:</strong></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/99972e5e1f2d4be7b4c7adf5d64ddca6~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723889280&amp;x-signature=gs1zTvM2vEr28N1Ycs%2Bd8pBJiws%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">区别三:</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">python中定义变量的时候,不<span style="color: black;">必须</span>在变量前声明变量类型,而C语言和JAVA<span style="color: black;">必须</span>,<span style="color: black;">重点</span>是<span style="color: black;">由于</span>python是一个动态语言,变量的类型取决于值的类型,<span style="color: black;">亦</span><span style="color: black;">便是</span>说值了类型决定了变量的类型如下图所示。<span style="color: black;">因此呢</span>定义变量时<span style="color: black;">必要</span>给变量赋值,<span style="color: black;">由于</span><span style="color: black;">仅有</span><span style="color: black;">这般</span>,变量的类型<span style="color: black;">才可</span>确定。而JAVA和C是一个静态语言,一旦变量指定了类型,运行中就<span style="color: black;">不可</span>修改类型。</strong></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p9-sign.toutiaoimg.com/pgc-image/44137a8ea47244bc8f25100b1ecbc78a~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723889280&amp;x-signature=c8NRzt63%2BKj2GtHFt8Zc5%2FzoehE%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">区别四:</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">python中的整数类型 int<span style="color: black;">仅有</span>一种,它的<span style="color: black;">暗示</span>范围相当于JAVA和C语言中long int 类型。<span style="color: black;">另一</span>python中<span style="color: black;">无</span>char类型和double类型。</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">区别五:</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">python中的<span style="color: black;">选取</span>语句结构<span style="color: black;">无</span>switch语句结构</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">区别六:</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">python中的for循环结构和C,JAVA中的不太<span style="color: black;">同样</span>:</strong></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/09b7eb9bae714afea1a6012917d5aad8~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723889280&amp;x-signature=9xyXeBXjH4G8%2BkVhDqOjTBniPAE%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">区别 七:</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">python是一门既支持函数式编程又支持面向对象编程的语言,而C语言仅支持函数式编程,JAVA只支持面向对象编程。</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">区别八:</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">python中<span style="color: black;">无</span><span style="color: black;">知道</span>的main()函数,python代码是从上到下逐行执行的,当前脚本是靠if __name__=="__main__"来做为入口的。<span style="color: black;">倘若</span>脚本被导入时,则if __name__=="__main__"下的语句不会被执行。</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">区别九:</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">python中做if或while的<span style="color: black;">要求</span>语句不<span style="color: black;">必须</span>加小括号,而C和JAVA中<span style="color: black;">做为</span>if或while的<span style="color: black;">要求</span>语句<span style="color: black;">必要</span>加小括号括起来,例如:</strong></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/a9aa78e1dfb248eb803406d9176d2e69~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723889280&amp;x-signature=hNSVCucdr7uQN9rlcIUsRi04Ejg%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">区别十:</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">python中定义常量时,不<span style="color: black;">必须</span>在常量前加特殊的关键字加以约束,python中的常量是<span style="color: black;">能够</span>随时被修改的,<span style="color: black;">由于</span>python<span style="color: black;">日前</span><span style="color: black;">无</span><span style="color: black;">供给</span>一种机制来<span style="color: black;">保准</span>常量不会被修改。</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">区别十一:</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">python中的除号运算符有两种,一个是"/"<span style="color: black;">暗示</span>自然除,返回的是一个浮点数;还有一个除号是"//"是地板除号,两个整数相除返回一个整数。这个“//”除号相当于C语言中的除号/。</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">区别十二:</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">python中的函数支持关键字参数和默认参数,而C语言不支持默认参数和关键字参数,JAVA不支持关键字参数。例如:</strong></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/pgc-image/a8478aa3a7fc43bcbfae88a3b1f68367~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723889280&amp;x-signature=26pkzRB1U4g%2FSzH2zic3hcKwod0%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">区别十二:</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">注释方式不<span style="color: black;">同样</span>,python中<span style="color: black;">运用</span>#来做单行注释,用三个双引号或三个单引号</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">来做多行注释,而C语言和JAVA<span style="color: black;">运用</span>//来做单行注释,用/* */来做多行注释。</strong></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">例如:</strong></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p26-sign.toutiaoimg.com/pgc-image/4e412e8327d446b2a6cc64fd610e1736~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1723889280&amp;x-signature=J%2BWbl0BMihSpK5wa8k5KM2y%2BOXM%3D" style="width: 50%; margin-bottom: 20px;"></div>




b1gc8v 发表于 2024-10-26 04:10:05

我完全赞同你的观点,思考很有深度。

4zhvml8 发表于 2024-11-10 10:57:51

谷歌外链发布 http://www.fok120.com/

nykek5i 发表于 2024-11-14 22:59:14

你说得对,我们一起加油,未来可期。
页: [1]
查看完整版本: python与其他编程语言区别全在这