python脚本开头

#!/usr/bin/env python
# -*- coding: utf-8 -* print "你好,世界"

不要问为什么,记住就好了

变量定于的规则

  1. 变量名只能是字母、数字或下划线的任意组合
  2. 变量名的第一个字符不能是数字
  3. 以下关键字不能声明为变量名
['and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'not', 'or', 'pass', 'print', 'raise', 'return', 'try', 'while', 'with', 'yield']

python的注释

  • 当前行注释:
#被注释的内容
  • 多行注释:
"""被注释的内容"""

也可以是打印多行

#!/usr/bin/env python
# -*- coding: utf-8 -*
name = """
你好世界
我是honry
我喜欢python
"""
print(name)

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAksAAABbCAIAAADsllbnAAAEM0lEQVR4nO3dzbWbOhSAUZWTEqiIcqgmVONilMHFGJCQ+XGctU72HryHdWXi2bcExkoZACJK//oDAMBfoXAAxKRwAMSkcADEpHAAxKRwAMSkcADEpHAAxKRwAMSkcADEpHAAxKRwAMSkcADEpHAAxKRwAMSkcADEpHAAxHSucCml+b+NCafOVr4r7Tv1aQH4n/2twjXKVIZtb0LjGADaLi659gJWjdCFwlnDAXDTZy4q5v1FW5klazgAvuBoM+ZubbJULdCFxdmyi9ZwANx3qBllzMqX+UDhTk17+ycAaLh+lbK9hmssv46HcHn98/jnBIB8v3B7L8vjvfOUb6kmzYVKAE75WOHK8XygcI1uvT0PADScLtzbFVj5lup5Dv5zp94CALMra7jqy3x+DXfn3wKAtouFKy8tlmFrXH7cU55qbwQA2pQDgJgUDoCYFA6AmBQOgJgUDoCYFA6AmBQOgJhO7/FdPtZdTqg+5QYA33Ruf7j2T3aVL9cjY59SSv149bMCwHGn13Cbg/K4uYYbe4UD4Cs+ULjqhJ0RhQPgS47+zH9be+biTAoHwJd8eA33ztinfhi6lFI3PKaxx9CleWC6V/ea8zOQ+nGa1v9+DeXlIQAs3S3c8uDAOm/sp5TNi7nH0HXD4/X/2pyxXyUx5zz2z5fjsBwHgMmtpwUaK7mdPy2jdeHgZQri2Fu+AVB1bn+4tPMVynJw51ZcGa3qGu594Z4XNwUOgLoT3zTJRcDm4+XMcvBpummW+nF1/6xyH24559ecyW5zPfJ1qRIAtq7ch9tkrPry6ldRTnCFEoCG61cpN4PpxDMDN/kCJQDv+dFIAGJSOABiUjgAYlI4AGJSOABiUjgAYlI4AGK69buU7ZkHT3jqAwDAQUcDs3lwu3rQVs7JHyvctOeOR8ABmH1gf7hqpQ4u8j73uyf2VgVg5ZM7oLYXcLn2y17Vkx/0GIZF0hQOgJUTewu8DdjBU+VP5K1ImsIBsPLVNVxeFK4854+xTyn1fZ/Sa6fv50225+Hv5x47819+CjcMXVpuslPZl6eYA0BQdwvXaNXe+LvV29j/VGu5J+qzSOMwp6lcw81FbOytupkDQFi3nhYoW3XkMuaBwm239p4itdoRbu8q5akDAMK6vj/c3oXK9sgmjbVSjn3arL3y84JjLWnjuFOv6hpO4QD+Fye+aZKLp9/m49xcwFUnV1/mnH8K13WvO2zz8Prm2XSTbXmDLvXjanvUyn24Yg4AQV25D9fO1d67ygk7K8L6Amt1hRIA3rl+lbIcPHgfbp5cHZnWV93yGyUWXACc5mchAYhJ4QCISeEAiEnhAIhJ4QCISeEAiEnhAIhJ4QCISeEAiEnhAIhJ4QCISeEAiEnhAIhJ4QCISeEAiEnhAIhJ4QCISeEAiEnhAIhJ4QCISeEAiEnhAIhJ4QCI6Q+8ba7ZkgGllwAAAABJRU5ErkJggg==" alt="" />

input(用户输入)

#!/usr/bin/env python
# -*- coding: utf-8 -*
name = input("you name:")
passwd = input("you passwd:")
print(name,passwd)

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbkAAABGCAIAAADehX0HAAAFdElEQVR4nO3dzZXiOBSG4RvJTBpKCIUBEbR2RMG2tK8oWLQSqHESmoWsf2zhrj5Amfc5c7oZI//05juSje+Vr68vDwBYJWQlAAztLSvdp5KTqE/37AsBsCt7y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c/chix2lTgVPSRCud/mtmPaMSVjOyYeiqAEducpPSTu+PEjALySJ/SQmO9MrvT4BoAXs9ffVwLA30RWAsAYWQkAY2QlAIyRlQAwRlYCwBhZCQBjZCUAjG39LTrv2wB4Rxtrsj02K6v3KfvXwXNpouay0nUW+xRvCvW1MgFg3atmpW3eqHTmEN+JtFpEf5Q1POpqlUWZ4bqsRvq6LZoJAAOvmpXt6VZ7QrRfar2Yla6s4AYAd9qclcaoWyXYwoa5INodY7peFAun67+q067pVRFrpaeSl4eDqlbg+Z/AGhzA/bZmpcRSuumGYF+1d2FMXjX3vSiWTtem2e1pYa4v3BZFz8e3OnXpUXX/CwAY+rM1+NYP7TOYrhfF+uny/y+Em9XhDqZU+oX6h3dGrfd3BIAbvpmV9/QmK+ZvztXL8vWoqrKsDDlnTPVspw3R4hq6MXks80oAd9tc61e0Xe55a1fH1NnY9KJotL8HqueM9dmq4+afCaXGO/UvhvIIkhLAvZ723s7f6EUBAA/y+KwcPPwGgBfE++AAMEZWAsAYWQkAY2QlAIyRlQAwRlYCwBhZCQBjZCUAjJGVADBGVgLAGFkJAGNkJQCMkZUAMEZWAsAYWQkAY2QlAIyRlQAwRlYCwBhZCQBj/wM3R2JrZnIZ9gAAAABJRU5ErkJggg==" alt="" />

info

%s 引用

#!/usr/bin/env python
# -*- coding: utf-8 -*
name = input("you name:")
passwd = input("you passwd:")
info = '''
--------- info %s
name:%s
passwd:%s
''' % (name,name,passwd)
print(info)

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAmIAAACMCAIAAABQ5VJqAAAJAElEQVR4nO3dzXXjOBYGUETSnQZC6ESEMFwRDHaOwtvCvqLwohnBKAnOguK/HiVPlcu26t7TxyXTIKhefecBJF/qAYBA+ugvAACfl5gEgNDXjsnuR07fUv7RffQXAeAxfe2Y7Pu+vaTy+tFfAoAH9dVjsqvPuZ4/+lsA8KC+Vky2kkrbHHnaHAGAXyaMyZJSSqm0vm/zx76rOaWUcu36/vKXacjVuBpO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epbl29LnriJT48qrr4YFgL3PGpPbV9F19TS+4LyVSxuvVbfo1XvWxxO71nZvRR/6Yx5fHQD6vv9MMbkPreivu5HbP5YSxuSiGxcA3BLGZJsbZKVV2bau8uaFz3HQ8si/Q+k3N9tat3fOOR/Vc9ervXXQLUrH4dehTfPYq7KeTnn1/VpJpVp0BeA+x22ZU2nHrZKPS8Dh9yG4SptLu0UT5jfG5PVicBw47mXOJ7a6WKodY3vui6mwBODQcUzusnAuFTf15DJw1kdaybWW7SlRyl79AvPvQa61MuxWppX9yuz3vqv5YJkXAFaOY3Ks+TbV5FwFTtXaYp1zd6SkVOqydBtnbOVw4XMVY8t862pd3cKzzc/FpXdj5rGqSQBuuRGTOa/LskuheDrlYetx/5TG/siwFrq+m2aY57JpOT3esYjM7cMe60px2mfc143z9ackXu+dziOEJAA33LPoCgB/qOM7XVVcAPzRvNMVAEJiEgBCYhIAQmISAEJiEgBCYhIAQmISAEJiEgBCYhIAQmISAEJiEgBCYhIAQmISAEJiEgBCYhIAQmISAEJiEgBCYhIAQmISAEJiEgBCYhIAQmISAEJiEgBCYhIAQmISAEJiEgBCYhIAQmISAEJiEgBCYhIAQmISAEL/AyWld+4j6gVvAAAAAElFTkSuQmCC" alt="" />

%d 引用

#!/usr/bin/env python
# -*- coding: utf-8 -*
name = input("you name:")
passwd = input("you passwd:")
age = int(input("you age:")) ## int 强制转换为数字类型
print(type(age)) ## 打印类型
info = '''
--------- info %s
name:%s
passwd:%s
age:%d
''' % (name,name,passwd,age)
print(info)

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAsoAAAC3CAIAAACE1+8hAAAM1ElEQVR4nO3dzXXjvBkGUFSStIES0ohQhqeCYOcqvP2wnyq8GFYQNcEs+E+KMuXBjCz53pPjkWkQ4rfikxcg39ACAFQV7n0BAMCzES8AgMqeJ140P2P4EeLP5t4XAgDf3fPEi7Zty1tI7/e+CAD49p4pXjT5Nebzva8CAL69x40XJYVUVkdeVkcAgDs4FC9SCCGE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Jm1UF3OMu+CNnVZDWNDtEutSwCA3/EI8WL9yu8mn4bGZSX17eDHVmZNjsv+acOJTSmbbmclhXVTVgDgd33NeLG92e/9dTNy/ceUduPFrKs7AFDPoXhRpkbrYVEmWFYVpgWKYdD8yK+u1DA1bR/O6xu7x3itfnC5urAMCLNSRfdrzM10YsmnU1xcX0khZYsjAFDbwepF6ePAdD+fbtubD/OzFkeGG34qUylhmHG5qHHpAtZ/vVx8GAYOezWmE0ueLakMcaefQSEDAOo5Hi82GWIqTazqF/Mb9fJISTHntD5lL51cvIDp9508UFK3GyMsbFdQ/mmbHK8sxwAAn3Q8Xgw1hlX1Yqo6jNWB2XrE5kgKIeV5qWCYsaSrCxSL2/88FzQ5L7Z2rnPH7Ks3Y6axqhcAUM8N8SLGZRmgL0ycTrHbWrF9WnR7pFuzWO6y7ObpN2WMj5nOosb6odNlZWLcR7GtU0zfPyaY5d6QaYRwAQDV3Lo4AgDwgeNPjvh/+ADAIV/nvRcAwJMQLwCAysQLAKAy8QIAqEy8AAAqEy8AgMrECwCgMvECAKhMvAAAKvu78eJQWxIA4LH9zXjR5NOsZ2nXEn15RMAAgCfwp+PFvBfa+vM/u38FAB7Y0XgxLmKsG7LPVzb6QR+3PmtyXA3aHgEAHtStDdmvfBgTQklXk4JsAQDP7fDiyFSrWG/KHJLBvJqxu8xR0rq4sT0CADy0G6sXTY7rosVoVoNomot5oclxPKfJuVw6AgA8uhurF/F0ikO9YlatWBc0Fhs05ps3Z2L+tTmiiAEAT+DTT4546AMAuOzzD6bOXoil7gAATLwUHACoTLwAACoTLwCAysQLAKAy8QIAqEy8AAAqEy8AgMrECwCgMvECAKhMvAAAKhMvAIDKxAsAoDLxAgCoTLwAACoTLwCAysQLAKAy8QIAqOz/gHpuQTHmYYYAAAAASUVORK5CYII=" alt="" />

%d是转换为数字类型,还有%f是转化为浮点。常用的是%s和%d

info2

#!/usr/bin/env python
# -*- coding: utf-8 -*
name = input("you name:")
passwd = input("you passwd:")
age = int(input("you age:"))
print(type(age))
info2 = '''
--------- info {_name}
name:{_name}
passwd:{_passwd}
age:{_age}
''' .format(_name=name,
_passwd=passwd,
_age=age)
print(info2)

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAArgAAACvCAIAAACZ7jpyAAAMkklEQVR4nO3dy3XjOBoGUETSkwZC6ESEMFwRDHaKwtvCvqLwohjBKAnOgu8HZNF2lWX53tPHJdMgxF7h4w+QCO1jKc8hvXz2RQDAowiffQEfq8nnmC+ffRUA8Ci+dFAoKaSyOvK0OgIAvN2tQSGFEEJIpW3L9LFtcgwhhJibtu3/MjbZHbC7k1POcTpt7CaEVLrPMcYQ4ukUpzar79p3yfF8Op1D+DGbgHhJ4UcIXYC45PgUQtfmaVZ72LZ5ivnSNr9i+BHC+dp3AsADu72iUNIwRpfcfWhyjLmZ/p3d4m/v9Wf99KP9tnFJIf1sSwoxN+PP7k/jd0yXseMlTQP8c2nbLjrkpm3Lc4i/mnmb9iVNbZ5L27bNrzi26XPGJZ9+CQkAfF8Hph76sbqkIQLsj/Q3BIVNm75KEUIfFFJZ/Fy0qNQq2nY20h/9EH6E7r8+KLQlnXPTNvlZLQGAb+3QGoWu+j+O0/WKQkn14byeKpocq0Fh+o62aWqD9/jIw/hhSAMlDRMN2zbTgxKXqefyvJybAIBv6eBixlXhf7NuoD+QUmWVwlAY6DLAWB7oPsfTKYbwz3+mDlKaep8vZJh6m6WWcwg/Qnguw4KDmC/DgoN+ycIrbRZrEcaJCQD4xo4FhWna4cE1+fxN/k8B4JrjTz08tnmlAQC+vS/9HgUA4M8SFACAKkEBAKgSFACAKkEBAKgSFACAKkEBAKgSFACAqscLCqsNKQCAt3u8oNBe3btyMG4k3bV/6nePHPZ32B4Zms62mxr3nJze5DhuG2GfCAAewvcLCt1YPr2kebatwyXHp/jf/803epi2nWy7cDDuQvmy+YZLjk/DXpdnL4EG4BE8fFDYDQ0lPc2jwOzzfAPJLhmMtYGXFJ7T0LgpL6vNroUDAB7Q8U2h5ttDL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qoktQAAeEBe4QwAVAkKAECVoAAAVAkKAECVoAAAVAkKAECVoAAAVAkKAECVoAAAVAkKAECVoAAAVAkKAECVoAAAVP0fX/b61cjPvvsAAAAASUVORK5CYII=" alt="" />

在某种特定的环境下,你只能使用info2来进行拼接。

引用 getpass模块

#!/usr/bin/env python
# -*- coding: utf-8 -*
import getpass # 引入getpass模块
name = input("请输入用户名:")
passwd = getpass.getpass("请输入密码:") print (name,passwd)

用PyCharm运行会卡住,所以用电脑终端运行

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAnkAAACSCAIAAAC2d0ueAAAMG0lEQVR4nO3d0Y3ruhUFUAHBuw0ESPAqSAkpKUCqSICkL1eTOvLxAMMjkoeHkijL1lofF7ZMkYeUxtuyZ66X//7nn//+1z/+97e/Lzfwq+dPI3578e6ZAXBh98nabtDuyVpxC0CTrD0qa8UtAHU3ydpM0O7PWnELQMUdsjYZtLIWgClk7bFZK24BWJO1h2etuAXgB1krawGY6+uzNh+0shaAKWStrAVgLlk7I2vFLfDpHo/Hu0v4IrJW1gKUZO2R9mTt1Y5EtR5Ze5qPOB/e6Gr13M3V1v9d9eTHvdqKfbZV1j5+6u5etlntm+/qEOVAb8zaLzhTv+98iB8KahuqudVPsD4nr8yoGXWeP99zhluNEizdW+oJxi1L/YiT8zO8Zm15inR3zzyhnHmEqmO98bp23txPOPW/9XwInjiq2zc80QT9dzduW59rng/dDk9++j5hicpJBYN269m5RK1TN9mncD3SHbL2r2m/j/hz6PDpb/6BOWrErzkftpVxSNlT1+eC58MJRl8DzaqjPcrOk/CQ1zTb+rzIIf4Sz6zd/AqreyDf/tL1/KztlnTIvKYu7BefD9vKOO01k6wd8q7jmB8iHjHzg3ZsPfluL3KIv8TJWfv4qbp9tWV1O+6nWs/bs/a1qtWkyhkF0y93qS5OsJ6t9kHBQYNqm3JjcICCqWUWpNtPMJFqncHKtCYbFJMft7wbTD/Y0ho93r16u5xat85glOqsgzoz7atFZh4qW77eqA7XqqoqP6m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MwlawFgLlkLAHPJWgCYS9YCwFyyFgDmkrUAMJesBYC5ZC0AzCVrAWAuWQsAc8laAJhL1gLAXLIWAOaStQAwl6wFgLlkLQDMJWsBYKr/A9BTLpZc2TOdAAAAAElFTkSuQmCC" alt="" />

会发现,当你输入密码时会看不到密码

if判断之流程控制

#!/usr/bin/env python
# -*- coding: utf-8 -*
_name = "honey"
_passwd = ""
name = input("请输入用户名:")
passwd = input("请输入密码:") if _name == name and _passwd == passwd:
print("欢迎用户",name,"login..")
else:
print("账号密码错误,请重新输入")

如果账号密码正确

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgUAAAA+CAIAAAA03P8dAAAGH0lEQVR4nO3dy5WrOBCAYYVFQk0YdgSjnaPw9mp/o/CGCIYkahbiIfQoCeyxcZ//O3Pu0LgQrKosyUhGAAAQMZ9+AADAKWj1wJj40/RM9nw2zBhTuvyYamuvvR0A/G5NKdUURGHRJUqDpY+qN2pvrfpp1fC3M1fT/R2eaQQAvsW+jJntMYRZu1Qk9EbS80o7jWVjV10pcXfTP/ZeBABfqTVFtnQOzLYzIeWBo9ItqscHLq9eWDbYW2fHnRcBwHeqjLdUc7GS90ttluLbv/grLZdukX3y2mO7/tI7NQIAfo1n5w/09L2rfrywf5A+fDa+Ug9G291+fm7GXINRo0dvrsb4OjHa7mKMj7kEPYk05tLZcZqQMDfLjASAE2r9iY6elMMsn/5biizdSzmWPdPODT0A1aNf8/jdifgKYQcRd5/nmecYefRrzN2JyPC3W2KmcjLaH2anAZzVjnqgj+Gk/QZRq0gpfVcTfUv/oL1mKJaEvvfAXI3/b/5tkutvdpDB3ukZADivZ/sHpRpwrB60ROo5PXoY/RZ6U8uPi5aDOem7fh4dSmPWnySNwxA0tRlQAoDzeVn/QMq1IWqqdKalHrR/wX+uHgz2ZszVmLubJwM6O86TAdN0QiVmM0+wjCYBwFnV60H1m75ss382fTcO8uw6bnnyZ8aLXmewN36nBODsjowXKf2D6BJl6CZ7bfpReK9d2bzaP3i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rZ4+w//wwp6jJUrgKAj9s3XpQODWVPKhVCOU7/bJDm1pbv7OtnMgzbISQ9Qbf3D5SrqAcAzuhl9aD9TGNtaDB/ze/dZtw/NzdQiDFRolYG9JcrTHEeYvNQZjMhsdwq8zx/MoWBUgHg3Vp/byp78vi76sGLVcaKGtsoThsAwKntex8tPRMODZWmB7KJPgwoxbxL5UdFu+S7EQBweiwTBAAQoR4AADzqAQBAhHoAAPCoBwAAEeoBAMCjHgAARKgHAACPegAAEKEeAAC8/wBmIM58JA4N8gAAAABJRU5ErkJggg==" alt="" />

如果账号密码不正确

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAckAAABICAIAAAASxpnvAAAFT0lEQVR4nO3dwXHjOBCFYYSliBiGnIFujmLOujsKXZSBksAevDNLAd2vm2SvLU/9X025aAgEQE/puUVTYusAgGrtuxcAAH8hshUA6o3Z2lrcYrab3Vpr3u77hKPVTgcA+9iB2H/H4mzoNuxiz+HnnTeL3kUdz8FsfVxO59be2unj7rYAQCROIrOSXSegF7h6kLldjJOM4E0ZLVx/teUWtACAENSAYdHanovc7p8c8KYIt3fsHu4o3S/vp8tDtwCAYtekQ8vcx2x355CZmyxIxcjeFObKE8u+LuflGrQAgLLnfKuOwk1ZXFi3zos3+8fZ+ric3i933QIAkso7HXDrxJy/ej29ucR23/Inr1xlKt2W9usatACAFGSrfp0+17NdJrIXhWFoZurWfP5q94/TcEnA3AIA2p661cvTfdma6anzcViMniKMWi4SAHDcobq1+zk7DOW1ZLI1X3gezdbb0t7av/8+TwLMLQCQoP7go4vHME+TL+Q3bWsl5wQA4LjsOQFRtw67iJfn5r7zQ+u5NiVjWLcCwNcgdwCgHtkKAPXIVgCoR7YCQD2yFQDqka0AUI9sBYB6wfumzBazXVysml1K1JM3BQD4KfZ8xuC627CLPYffrg19ksMCwLeL48kMtSH+RGfRrnc0H83MFbgtqw9euS5nPi4AQL3486V00TpUlz0Ro2K6cPdD2fp5V8Hzn7uz3C/vv+8m8Liczty1B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Yf55NuAAAAAElFTkSuQmCC" alt="" />

if多重判断

#!/usr/bin/env python
# -*- coding: utf-8 -*
honey_age = 22
age = int(input("honey的年龄:")) #由于是数字,所以需要int转换,不然报TypeError: unorderable types: int() > str()
if honey_age > age :
print("猜大点...")
elif honey_age < age :
print("猜小点...")
else:
print("蒙对了")

运行三次,结果分别如下

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXEAAAAwCAIAAABolt2OAAACxklEQVR4nO3cwXniMBCG4SnLFakMUsHqRhV7Vis5xBUsTSgHsAFLGo2dgXjhew+JkYVsH/Q/khBIBgA/8suXF1FeKoUb2gHwBJ2+F0REQnrQtYuevyFTzmdlYnkLgMfp9r0UHpMpcq8sbNVc1Ln9O9fPG2MlhYPIh8iHyN/UKAGg+c1MWRyXJdkwqbG/t2eMx+lJT3E4DH/+LUviaU17wFvaS6ZUs8MyOVIGL92r3EvhMD9pCsf4VZSM1ocD3pcpU2IcRGSY+9QYB5kL0nnNxVBHQroe6iMLy9yn82CN9Ok9b855jMfFkKQsAVBnyZRzMMwDljEOQxyv/7U6OYW5zpQ3KcaxsZ6S1blM7s195r/G3Kk/73KOU5YAaLLPfdYezC7Th0vMpHB+rafGTzJFqdzxGeRwP9ErSwCoNmRKdZzSqJNzHsf76dClixqTQpdvZjTV8c6iTS1lPsP1k51TSqdaCYAey/4UkZBul0SqayWNOve7W64TIFOmVG5XramMWXInU8Z4nD4z/hA5xq+ihAVawOKpe8OmeU/O7fWU+Wy1hVZSLNrZtJICwMFz+t7tAGa6cHvFREkEPSz0sQ+AJ6DjAfBEpgDwRKYA8ESmAPBEpgDwRKYA8ESmAPBkzZRtWz/YJAK8m/4vBnS/caO/3dKUw3MA2AeHcYoSEJa8IFOAV+I8TpHa94n19n/4AAB2ZfWvpelnV41TCBTg9Zh6tT5C0adFSpvr7xbA3q1YT1HyYp7yLE6RKcC7Ma2hdsNikSnVkrLZ9XcLYO9Wj1Nay67dlNHrA3gNq8cp1bBoJQiZArybLeO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5ErkJggg==" alt="" />

while 死循环

#!/usr/bin/env python
# -*- coding: utf-8 -*
count = 0
while True:
print("count:",count)
count = count + 1

运行的结果就是不断的打印

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAnYAAADbCAIAAABvK0u3AAAO+0lEQVR4nO3dy5GzuhoFUMIiIZTHnwDRWMm0EzhZ9B0Y68HDBhpdl6vWGtGyBPRolyTg6/77779fAOBqnYgFgBZELAA0IWIBoAkRCwBNfEvE3se+y/rx/vv7G0NqCPH3d2dLcaZFy9QAAH/3sYi9j+ORPLvHeK9bYngE7e8jI8PtN4bu2RRD92iZ97mPw7Nl6nMf+yKPhSwAF/lUxC7T7HW+LSN2OfQ+9n3Oz3RY9SmvEsMUzFWLjAXgEgcjNq2ppiSaWqZAi2H67XFwmxZqwzj2s07dsbXZOA7Dczm3DM90weLP+WlnffKN9+P9t5jF3sfeWjEAVzkUsSmN0myvyKmcn4+fyoNHKv5pvhjHYoF3fYb6+xtDfVtrfX4XHZ653A9DL2IBuMihiH2xunvoYPVU+63fxrsl39yyzOgLbgoAaudmselhpe1ZbAzdnoiNcedCceirWezPakv1kHD9uNMzV+9jXyxyj7fq9iQsAJc5uBeb1lTTLLDei80NIYSu64Z/Ie2NTmOLfc/5NurLgMs7uOVjw/XOa379ZqtPtQ+cQtcrOwBc7lveiwWALyNiAaAJEQsATYhYAGhCxAJAEyIWAJoQsQDQhIgFgCZELAA0IWIBoAkRCwBNfEvE5q8P5y8QF98bzjV0TrSkk6/X3wGAMz4Wsc9aPXu7xziLv6KKTqqrU339v660s6y986wblGvvFD8CwB99KmJf1XNds4zY5dCyzvoiLTcv+HIUAJx1MGKXhd/qYnYxTL89Dm7TsmwYx37Wab5Y+0Ych2FeqK66YPHn/LSzPrOWqwrFA0DlXEn2FEXbJdnrUuf9eP9jmMVxXly9+C1fqr6ttT7zFhELQBOHIvbF6u6hg9VT7bd+G7c3598aZaEYgCbOzWLTw0rbs9gYuj0RG+POheLQV7PYn9WWtPq7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r4lojNXx/OXyAu6s5O3xe+qgUA/uxjEfus1bO3e4yzaq5FzZxUV6f6+n9daWdZe2djlJAF4BKfitg99VxLy4hdDi0LsRdR+uaCL0cBwFkHIzat16a4qovZxTD99ji4TYuwYRz7WaeDS7NxHIZ5obrqgsWfK4XqZtfZMwoA/uRcSfY0JdwuyV4dPFJxrST7bnFcLaVenyyG+rbW+hwaBQBnHYrYlzF14GD1VPut38btzfnPjQKAk87NYtPDStuz2Pzo0MuIjXHnQnHoq1nsz2pLWupdPty0e5SIBeASB/din7uWeUG13ovNDSGEruuGfyHtck5j06LsbPfz3Qwy7+CWDwDXe6j51Z7tPntGAcCffct7sQDwZUQsADQhYgGgCRELAE2IWABoQsQCQBMiFgCaELEA0ISIBYAmRCwANCFiAaCJb4nY/B3h/C3hou7s9Lnhcy353GoAAHCZj0Xss1bP3u4xzr7QX9TMSXV1qq//15V2lrV3ppaivI5adgBc51MRu6eea2kZscuhZUn1IkrfXFC9WACaOBixaU01JVFdzC6G6bfHwW1alg3j2M86zSvKvRHHYVgrOZcuWPw5P+2sz6ylLILbWysG4CrnSrKn2d52Sfbq4JGKf5ovxrEqpb4+Q42hvq21PmujpugeBiXZAbjKoYh9HVP7D1ZPtd/6bdzenH9Hi3ViAK5zbhabHlbansXG0O2J2Bh3LhSHvprF/qy21Ku/t72j8mRWwgJwlYN7sWlNNS3D1nuxuSGE0HXd8C+kvdFpbLHvOd9GfRlweQe3fGy43nnNr99s91m0LPeXAeDvvuW9WAD4MiIWAJoQsQDQhIgFgCZELAA0IWIBoAkRCwBNiFgAaELEAkATIhYAmhCxANCEiAWAJkQsADQhYgGgCRELAE2IWABo4n91h3o30Fk00QAAAABJRU5ErkJggg==" alt="" />

break 跳出循环

#!/usr/bin/env python
# -*- coding: utf-8 -*
count = 0 #定义次数
honey_age = 22
while count <3: #定义count不能大于三,也就是说有三次机会
age = int(input("honey的年龄:"))
if honey_age == age :
print("猜对了")
break #如果猜对就跳出,结束
elif honey_age < age :
print("猜小点...")
else:
print("猜大点...")
count +=1 #如果没猜中三次,就计数
else:
print("三次机会用完了")

如果才对就会跳出循环,猜错就会循环三次后跳出

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAA8QAAACKCAIAAADjdBQhAAAJd0lEQVR4nO3du1nrzBqA0SlLFakM6EDZroJYOVWQqAOa0A5shJE1V18w1lrB/s0wFnb2nnm+I4UZAABoEn77AxyFEBI/JhYbrgMAAFdR2pp9CCH0440+xFnyNsT04bfhS8lbAADgEuWtOfa3ienw0/libOdqz+m/y/75kp7+6PuP1m8FAMAOPERMr16fr8wF8xvl7837HLqXEF664bPufQAA7MrDxfRmNJfMgSSOq7N/ZcvYv9xqrAUAgOdQF9PD0IUQumE6rk1DF5aF8TBXXbAn9OP3y/RZcsmYR+YbRrI783U/h+7f8h0AAGBDVUwfing5op6Grhum7/+m9sxjv+z5Cu1xGKbIzPScHNuYc2Mey7+Fwb3how9vDqYBAEhpGPOofbE4Tk0c+3rsDz+nc/mSmE5szpreu+7dwTQAACmXxPTmyXRkzzzP0/Rz8uPY1oWJnDafDG9snnCvrpnN6/EtuJUHAABpVfeZDqEfT8eeN+ehI3t+3qX6e9ajKKY3PndyZ+KUes7G9OFWHq8hvAaH0wAAJPzOM02+RjzmOT4zvfx28wqxRF5dp2VaGgAAyty5NU+PrL8+QXwqOpHC6UpOn3YDAMBVCE0AAGgkpgEAoJGYBgCARmIaAAAaiWkAAGgkpgEAoJGYBgCARnUxXXX/5pIbPLsJNAAAf1dpyy6P5o6JvSV72ex1AADgMVXE66p0nUwDALBz1SfTc/FxspgGAOC5XXNmOjEEctrcVbMiAADwsKpj+vKZ6UtOsgEA4HHUzUyfDnucrm9uTv+qfB0AAB7TrWamxTQAAE+vZWY6ezLdPFpd9WEAAOB3NcZ0OoLTMV1g7EM/Vq8AAMBdXf9kOt3W5xc5fwEAAH9Cxcz0ZvWu1hPz0OchrqcBAPjTxCsAADQS0wAA0EhMAwBAIzENAACNxDQAADQS0wAA0EhMAw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yt8x+NeQAAcKHScCyfPy6J1M2R5cQc8/lFYmMhpxeJXTA2Mx1bBwCATcIRAAAaiWkAAGgkpgEAoJGYBgCARmIaAAAaiWkAAGgkpgEAoJGYBgCARmIaAAAaiWkAAGgkpgEAoNF/PUadHFUdWGkAAAAASUVORK5CYII=" alt="" />

for循环

#!/usr/bin/env python
# -*- coding: utf-8 -*
for i in range(10):
print("你好",i)

运行如下

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAqsAAADJCAIAAACL2uzeAAAI/UlEQVR4nO3d3ZGjOhAGUMIioSUcsiEagmEfZow91g9ItoWrdM7DLcF1be1bf9stu4cNAOjPcPVfAAC4gAQAAD0qSADDMOz/zXwAAPh+H0kAw18v/hUBgLc7W55T1f2xwEeLfTYBrPM4DMMwjPN6/q8MALysJgGE74sywW6dx2nZtm3blkkGAICWTiWAva4/5YBosU9lhcA6j3vdFwEAoKnjBBAd/4fVvTwBLNPw2wL4ewYAPq5yCpDvAWTuCjyQAADgMi8lgNRjeI4xBQCAy7wnAYTvt+ME4CYgAFymLAHkh/2HdwUCvg0IANco7gFEH7eqHgAAcJWaBBBe7gsLv18DBIBvpkgDQI8kAADokQQAAD2SAACgRxIAAPRIAgCAHkkAANCjggQQXRIYfgAA+H4fSQAnFgMCAFeq2QyUKvDRYn+YAJbJXmAAaK1yN+DT+6JMcLdMwzAMgwQAAK2dSgB7XT+zCziVFRKWSQIAgOaOi3R0/J/aDRg9ZEkAAHCByilAvgeQuSsQkAAA4AIvJYDUY3hOkwAA4ALvSQDh+00CAIAvVpYA8sP+w7sCz36/C+D7AADQWnEPIPq41fcAAIAL1CSA8HJfWPj9GiAAfDNFGgB6JAEAQI8kAADokQQAAD2SAACgRxIAAPRIAgCAHhUkgOiSwPADAMD3+0gCOL0YEAC4Rs1moFSBjxb7XAJY59FeAAC4QuVuwKf3RZngZp3/zevPcZlkAABo6VQC2Ov6mV3AqawQeNwLbEcwADR1nACi4//UbsDo4dA6j+OtHQAANFA5B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+kBAACXqUkA4eW+sPD7NUAA+GaKNAD0SAIAgB5JAADQIwkAAHokAQBAjyQAAOiRBAAAPZIAAKBHEgAA9EgCAIAeSQAA0CMJAAB6JAEAQI8kAADokQQAAD36D5oQ5FxmI2r/AAAAAElFTkSuQmCC" alt="" />

打印整数

#!/usr/bin/env python
# -*- coding: utf-8 -*
for i in range(0,10,2):
print("你好",i)

运行如下

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAj8AAABqCAIAAADcEqcNAAAEbklEQVR4nO3d0Y2kOhBAUcIioUc4ZEM0BMN+7AzT08ZQdoOeSnvOxwjQatV/V8bINWwAkM3wf/8AAGimXgDk01yvYRj2vyf/AACe82C9ht+6fyIAvGmLSq1Mr3E6DNVpvdZ5HIZhGMZ5bfo1APyr+utVPm/q2W6dx2nZtm3blkm/AIhoqNfepLeGHYaq1rnCOo97s+QLgJBovQ63u8oytddrmYavpdfvawCo+ujN4fna62Rv7IV6AdDshnrVbsvrI94cAtDsznqVz7frevlqA4BmPfU639y63Bsr+GIegDada6/D261r7QUArfrrVX6IUUbLKRsAPEFaAMhHvQDIR70AyEe9AMhHvQDIR70AyEe9AMjnwdnKAPCQB+sVOGAeAHr0n9LbNEn5rF7fxxwOg/koAIR8dMb82/Omnn1b5/9+BqToFwARDfXamxSZh1LrXMF0SgCaRet1uN1VO2P+8OLS65xKADhxw3TK2trrZG+sJF0AxN05WzkyrPLQMplMCUCDO+tVPt8C9Vrncd/sWufZvhcAl3rqdb65dbk39tsyvb5btAQDIKB/tnJ5u3WtvQCgVX+9yg8xymg5ZQOAJ0gLAPmoFwD5qBcA+agXAPmoFwD5qBcA+agXAPk8OFsZAB7yYL3iB8wDQJP+U3qbJikH6mU0JQBRH50x//a8qWdvlmkY1AuAmIZ67U2KzEOpde7YMg3TZO0FQFC0XofbXbUz5g8v6pZpnFdvDgEIu2E6ZW3tdbI39mqZ/kZLvQCIunO28uF662rt9Xs6pb0vAALurFf5fAvue22btRcAcT31Ot/cutwbO7DO49fSa5zXpl8EwL+of7Zyebt9tPYCgKj+epUfYpTROvlYAwC6SQsA+agXAPmoFwD5qBcA+agXAPmoFwD5qBcA+Tw4WxkAHvJgvSIHzANAh/5TemtxOgzVeb32Yw4d0wtAxEdnzL89b+rZj2X6PpvXMfMAhDTUa29SZB5KrXOFdR6dKw9Am2i9Dre7amfMH15ULNMwzd4cAtDihumUtbXXyd7Yi2Xah3pZhgEQc+ds5cP1VuDN4b7isu8FQMid9Sqfb9f1evlow9oLgJieep1vbl3ujRX2D+a1C4CQ/tnK5e3WtfYCgFb99So/xCij5ZQNAJ4gLQDko14A5KNeAOSjXgDko14A5KNeAOSjXgDk8+BsZQB4yIP1ChwwDwA9+k/pbZqkfFavZdr/EyfMAxDx0Rnzb8+bevbt54j5bZn0C4CIhnrtTYrMQ6l1rvA6FmWZnDIPQEC0XofbXbUz5g8v6vZXhxZeAITcMJ2ytvY62Rv7ZZn+VstwSgCC7pytfLjeulp7LdPPkuv1GgCq7qxX+XwL1es7Wes8qhcAAT31Ot/cutwbe7fO49ebRS8OAQjpn61c3m49ay8AaNZfr/JDjDJaZx9rAEAvaQEgH/UCIB/1AiAf9QIgH/UCIB/1AiAf9QIgH/UCIB/1AiAf9QIgH/UCIB/1AiAf9QIgH/UCIB/1AiCfP5FPjHA2kItmAAAAAElFTkSuQmCC" alt="" />

for 流程控制(是否进行)

#!/usr/bin/env python
# -*- coding: utf-8 -*
count = 0 #定义次数
honey_age = 22
while count <3: #定义count不能大于三,也就是说有三次机会
age = int(input("honey的年龄:"))
if honey_age == age :
print("猜对了")
break #如果猜对就跳出,结束
elif honey_age < age :
print("猜小点...")
else:
print("猜大点...")
count +=1
if count == 3:
_count = input("你还要继续吗?如要退出请输入n,继续任意键")
if _count != "n" :
count = 0 #赋值为0继续下去

运行如下

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAA5wAAAEECAIAAADLeqyBAAATzElEQVR4nO3dwXWjsBYGYJVFRZSRVPDYTRVZs08VWT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uKvdPbXl1oLkS6EWAIC7OhJq6yu1l+OFNQEA4Bq3rNTmmmiFWgAA7qq2pzYZWAvjlxOSybXwFgAA7CJTAgDQPKEWAIDmCbUAADRPqAUAoHlCLQAAzRNqAQBonlALAEDzhFoAAJon1AIA0DyhFgCA5gm1AAA0T6gFAKB5Qi0AAM0TagEAaJ5QCwBA84RaAACaJ9QCANC8/wMiGqjdTi5m6gAAAABJRU5ErkJggg==" alt="" />

continue  跳出本次循环,继续下一次循环

#!/usr/bin/env python
# -*- coding: utf-8 -*
for n in range(10):
if n < 3 :
print("次数",n)
else:
continue #break是直接跳出整个循环
print("contiue跳出本次循环,继续到下次循环")

运行如下

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAA2kAAACFCAIAAABOhCeVAAAJiUlEQVR4nO3dy5GrOhQFUMIioUs4ZEM0BMMb2MY2+h3o6n6Wa61BNxZC2LNdBwkNGwAAxAxXrhlqV72erfcEAKAvoWx3iIClRHhrT/8CAPAdotnuUE08qPRsDbzO4zAMwzDOa/CrAADwPzldF0zj4F5iTANlKV/u1nmclm3btm2ZpEcAgA93MTvuWTAtOqanytXHdR73xCg8AgB8unPZsR4HX2uNh5bCeMs03MuO78cAAHyii2tZSk+ut3MrZmRHAICenMiOkWpidt2MZ9YAAN/h4jrrrTDT8bAypvmmHmtlAAA6cvr9jpVX8GRnQ7Ze0+MdPQAA3bi4VqbUcngdjzeEAwB8kyvzHbPt9UfV4iMAwBcQ6QAAiJIdAQCIkh0BAIiSHQEAiJIdAQCIkh0BAIiSHQEAiOogO17Y6jDyOskf9ilt5+1NlgDAF/v7oLNMw30L66B0q8PShtrN41L/UmPz2uwu3luSd4dEdlgAgA/39yFmnf+d27r6ENS29+zY3ES7lPNKea4UAQ93r9803gIA0JFfjzLrPJ+qMqayNbzXg71b8/gwbPO+lZZSQbFya8ERAOjdb6eZ00+oS7K57dChXlDMdm7esVSPrDSWWmRHAKB34TSzzuMtbe1R8N4yzuu2bcs0DMMwzfO4N93b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+AgCdCoaYSgSsHNQvrIzzVq1Mo17p7/NXBZZg1yuLrweRDmmhMb1cdgQAene27rivfcnWHcvZcVkKaXLvMA3HuuO2retaru2Vqn2Vj80CYfNG2QEjQ2XHAQDoSzjNPKqBz0mImfmOwzAt75MaH9Mkk5LicdrkNE3JRbeP6RPqa3XHbI1wH/ZaCmzWHSuDAAB0p4M0U0pgzUSYzXPpOKWbVlqy3+HQUh8BAKBHnaWZtP4XCWRns2PpVCkyNnNq844AAF2QZgAAiJIdAQCIkh0BAIiSHQEAiJIdAQCIkh0BAIiSHQEAiJIdAQCIkh0BAIiSHQEAiJIdAQCIkh0BAIiSHQEAiJIdAQCIkh0BAIiSHQEAiJIdAQCIkh0BAIiSHQEAiJIdAQCIkh0BAIiSHQEAiJIdAQCIkh0BAIiSHQEAiPoPc+af8owVzHMAAAAASUVORK5CYII=" alt="" />

for循环之循环套循环

#!/usr/bin/env python
# -*- coding: utf-8 -*
for n in range(10):
print("次数",n)
for i in range(10):
print("--------------",i)

运行如下

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAugAAAD2CAIAAAALe+UFAAAIQ0lEQVR4nO3dzW3jOhSAUZalEtTIsBx2w2pUjN8ijqwn/4g0HBEXPmcRGLSRMWb14ZIK0wUAIIg0+gsAALQSLgBAGMIFAAijL1xSevX57buvPwkA8IaDvNj1x7Mc+Vm//wkA8EHHebGbo+y8+OTRL17KlFJKaSpL11cGAL5Vx1zkvkXW4cp9zTyLm9VSplwvl8vlUrN0AQBadIfLGiL345b7t57PXZYyrbmiXACAJq3h8rpFtlOW3cqT31dzug5c/v8aAOCp7iO0zzaMLn1HdIULANCtKVxa5igPD+raKgIAPqj7qaLLk9Mtu6O4hw9FO5wLAPTq+DsuL552fngC5uiJaI9DAwB9ug/nPlvZPfnsz9ABAB/Xd8bl4frrHSLtAgB8iqoAAMIQLgBAGMIFAAhDuAAAYQgXACAM4QIAhCFcAIAwhAsAEIZwAQDCEC5d3K8EACMJlw5utAaAsYR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AMIQLABCGcAEAwhAuAEAYwgUACEO4AABhCBcAIAzh0mUpU0oppakso78KAHwh4dJhKdP1PsiapQsAnE+4tFvKtOaKcgGAAQ7CJaedef6WletsZaPm2+L2NQBwEhOXdsIFAAYTLu1sFQHAYMKlg8O5ADCWcOnicWgAGEm4AABhCBcAIAzhAgCEIVwAgDD+A42SL0KAZ6B+AAAAAElFTkSuQmCC" alt="" />

可以看的出。每打印一次n就打印十次i。

python基础篇的更多相关文章

  1. python基础篇-day1

    python基础篇 python是由C语言写的: pass 占位符: del,python中全局的功能,删除内存中的数据: 变量赋值的方法: user,pass = 'freddy','freddy1 ...

  2. python基础篇之进阶

    python基础篇之进阶 参考博客:http://www.cnblogs.com/wupeiqi/articles/5115190.html python种类 1. cpython  使用c解释器生产 ...

  3. python基础篇(六)

    PYTHON基础篇(六) 正则模块re A:正则表达式和re模块案例 B:re模块的内置方法 时间模块time A:时间模块的三种表示方式 B:时间模块的相互转换 随机数模块random A:随机数模 ...

  4. python基础篇(五)

    PYTHON基础篇(五) 算法初识 什么是算法 二分查找算法 ♣一:算法初识 A:什么是算法 根据人们长时间接触以来,发现计算机在计算某些一些简单的数据的时候会表现的比较笨拙,而这些数据的计算会消耗大 ...

  5. python基础篇(一)

    PYTHON基础篇(一) 变量 赋值 输入,输出和导入 A:输入 B:输出 C:导入 运算符 A:算数运算符 B:比较运算符 C:赋值运算符 D:位运算符 E:逻辑运算符 F:成员运算符 G:身份运算 ...

  6. python基础篇(二)

    PYTHON基础篇(二) if:else,缩进 A:if的基础格式和缩进 B:循环判断 C:range()函数和len()函数 D:break,contiue和pass语句 for,while循环 函 ...

  7. python基础篇(三)

    PYTHON基础篇(三) 装饰器 A:初识装饰器 B:装饰器的原则 C:装饰器语法糖 D:装饰带参数函数的装饰器 E:装饰器的固定模式 装饰器的进阶 A:装饰器的wraps方法 B:带参数的装饰器 C ...

  8. python基础篇(四)

    PYTHON基础篇(四) 内置函数 A:基础数据相关(38) B:作用域相关(2) C:迭代器,生成器相关(3) D:反射相关(4) E:面向对象相关(9) F:其他(12) 匿名函数 A:匿名函数基 ...

  9. Python基础篇--输入与输出

    站长资讯平台:Python基础篇--输入与输出在任何语言中,输入和输出都是代码最基础的开始,so,先来聊一聊输入和输出输出输入END在任何语言中,输入和输出都是代码最基础的开始,so,先来聊一聊输入和 ...

  10. python基础篇(文件操作)

    Python基础篇(文件操作) 一.初始文件操作 使用python来读写文件是非常简单的操作. 我们使用open()函数来打开一个文件, 获取到文件句柄. 然后通过文件句柄就可以进行各种各样的操作了. ...

随机推荐

  1. VMware下利用ubuntu13.04建立嵌入式开发环境之二

    之前在VMware中安装完Ubuntu系统,接下来开始设置开发中用到的服务和工具,以及系统设计. 1.安装VMware工具:打开VMware软件,在菜单->VM->Install VMwa ...

  2. VS2012 调试时 局部变量显示不全的问题解决

    在工程上右键,打开属性页,配置属性——C/C++——优化,将优化改为“已禁用/Od“

  3. Onedrive 明年初基础容量缩小到5G,执行这一步骤避免(保持30G)

    Onedrive作为微软的云盘,相当实用,存储一些照片文档. 之前微软一直执行免费用户可以永久拥有30G空间(基础+开启功能获得). 但微软打算从明年开始减低这一优惠至5G. 不过最近微软有一些放松, ...

  4. Ext JS 4 新特性2:配置项属性(config)之一

    Ext JS 4 新特征2:配置项属性config 最新版本的Ext JS 4.2的另外一个伟大的新特征就是增加了configuration配置项属性,当我们在创建一个新类的时候,经常性的要设置某某属 ...

  5. js⑤

    ##返回在制定位置的的字符  var result = str.charAt(1);  console.log(result);  console.log(str[1]); ##返回在指定的位置的字符 ...

  6. OpenSSL 使用拾遗(一)---- 生成 pkcs12 文件

    从本期开始,记录一些在使用 OpenSSL 过程中碰到的问题及解决办法 在 Linux 下需要生成 pkcs12 文件,立即想到 OpenSSL.键入如下命令 ~ # openssl pkcs12 - ...

  7. Log4J日志管理类使用详解 (转)

    一.前言: log4j 是一个开放源码项目,是广泛使用的以Java编写的日志记录包.由于log4j出色的表现, 当时在log4j完成时,log4j开发组织曾建议sun在jdk1.4中用log4j取代j ...

  8. Spring事务传播机制&隔离级别

    一.Propagation (事务的传播属性) Propagation : key属性确定代理应该给哪个方法增加事务行为.这样的属性最重要的部份是传播行为.有以下选项可供使用:PROPAGATION_ ...

  9. liunx中字符驱动编写的简单模板

    下面是关于字符驱动两个程序,主要是说明驱动编写的思想,理解驱动是怎么一步一步被实现的. 驱动的第一个实现程序,是相对于裸机编程的,主要是体会一下驱动编程思想: cdev.h: 所包含的头文件 #ifn ...

  10. Android Studio 个人常用设置

    1.主题 Darcula主题真的看起来舒服很多呢: 2.常用快捷键 "Toggle Case" "Quick Documentation" "Refo ...