亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? python for newbies.htm

?? a collection of mega hacking tools
?? HTM
?? 第 1 頁 / 共 4 頁
字號:


<HTML><HEAD><TITLE>Python for Newbies</TITLE>

<!--Style from http://blacksun.box.sk/tutorials.htm :)-->

<STYLE type=text/css>A:active {

	TEXT-DECORATION: none

}

A:hover {

	TEXT-DECORATION: underline

}

A:link {

	TEXT-DECORATION: none

}

A:visited {

	TEXT-DECORATION: none

}

</STYLE>



</HEAD>

<BODY aLink=#ccff00 bgColor=#000000 link=#99ccff text=#cccccc 

vLink=#cc99ff><FONT face="Verdana, Arial, Helvetica, sans-serif"><A name=top>

<H1 align=center>Python for Newbies</H1></A>

<H2 align=center>by <A href="mailto:skinite@home.com">Pupp3tM</A>, a.k.a. David 

Borowitz</H2>

<H3>Table of Contents</H3>

<OL>

  <LI><A 

  href="#intro">Introduction</A> 



  <OL type=a>

    <LI><A 

    href="#whatis">What 

    is Python?</A> 

    <LI><A 

    href="#interp">The 

    Interpreter</A> </LI></OL>

  <LI><A 

  href="#first">Your 

  First Program</A> 

  <OL type=a>

    <LI><A 

    href="#hello">Hello, 

    World!</A> 

    <LI><A 

    href="#explain">Explanation</A> 

    </LI></OL>

  <LI><A 

  href="#varmath">Variables 

  and Math</A> 

  <OL type=a>

    <LI><A 

    href="#var">Variables: 

    Strings, Numbers, etc.</A> 

    <LI><A 

    href="#math">Math 

    and Operators</A> </LI></OL>

  <LI><A 

  href="#io">Input/Output</A> 



  <OL type=a>

    <LI><A 

    href="#print">Printing 

    information</A> 

    <LI><A 

    href="#user">Interacting 

    with the User</A> </LI></OL>

  <LI><A 

  href="#control">Program 

  Control</A> 

  <OL type=a>

    <LI><A 

    href="#if">What 

    If...</A> 

    <LI><A 

    href="#for">For 

    Ever...</A> 

    <LI><A 

    href="#while">While 

    We...and Others</A> </LI></OL>

  <LI><A 

  href="#inter">Intermediate 

  Python</A> 

  <OL type=a>

    <LI><A 

    href="#tuples">Tuples!</A> 



    <LI><A 

    href="#string">Strings 

    and Slice Indexing</A> 

    <LI><A 

    href="#fileio">File 

    I/O</A> </LI></OL>

  <LI><A 

  href="#mod">Modules</A> 



  <OL type=a>

    <LI><A 

    href="#mod1">Overview 

    and Importing</A> 

    <LI><A 

    href="#builtin">Builtin 

    Modules</A> 

    <LI><A 

    href="#yours">User-Defined 

    Modules and Functions</A> </LI></OL>

  <LI><A 

  href="#close">In 

  Closing</A> 

  <OL type=a>

    <LI><A 

    href="#perl">Why 

    Python is Better than Perl</A> 

    <LI><A 

    href="#ref">References</A> 

    </LI></OL></LI></OL>

<HR>



<H2 align=center><A name=intro>Introduction</A></H2>

<H3 align=center><A name=whatis>What is Python?</A></H3><BR>

<P>Python is, in short, a scripting language. It is similar in function to Perl, 

but to my knowledge is not nearly as popular. To fix that is part of the goal of 

this tutorial. It is a very high-level language that can perform complex tasks, 

but is surprisingly easy to learn. Many different add=ons (modules) are 

available to control everything from MP3s to windowing toolkits (Unix). I find 

Python to be a just plain <I>fun</I> language to program in, as it is very 

intuitive and suited to a variety of uses. </P>

<P>Python can be run on almost any platform, from 'nix to Windows. To get 

Python, first go to <A href="http://www.python.org/">Python.org</A>, and then 

download away! </P>

<P>This tutorial is geared towards people who have little experience with 

programming but know at least something. I make numerous references to languages 

like C and Perl, which are good to know, but you won't lose much if you just 

skip over them. </P>

<P>What's with the funky name, you ask? Some sort of carnivorous reptile? No, 

dear reader. Python's creators were (are) big Monty Python fans. The name comes 

from the BBC show "Monty Python's Flying Circus," and in the official docs, it 

says "Making references to Monty Python skits in documentation is not only 

allowed, it is encouraged." That said, I'm afraid I haven't seen all too many 

Monty Python movies so we'll go a little light on the references :) </P>

<P>So sit back, grab a Coke, <A href="http://www.python.org/download/">download 

Python</A>, and get ready to learn :) </P>

<P><FONT size=-2><A 

href="#top">Back 

to top</A></FONT></P>

<HR>



<H3 align=center><A name=interp>The Interpreter</A></H3><BR>

<P>Python is a scripted, i.e. interpreted, language. Unlike C, which has a 

compiler, we have in Python the...(drum roll please)...Python interpreter. Once 

you have Python correctly installed, in your Unix shell or Dos box type 'python' 

(Note: anytime I tell you to type something and put it in quotes, don't type the 

quotes. I'm sure you already figured this out, but...). If you've used perl or 

some other interpreted language before, you might notice something: there's a 

prompt (those three little "&gt;&gt;&gt;" things)! Not waiting for stdin or 

saying "Usage: python &lt;script-file&gt;"! That's right, Python has an 

<I>interactive mode</I>. In this mode, you can type any Python command and it 

will work just like you typed it from a script, with a few differences. Most 

importantly, if you type a variable of some sort or something that returns a 

value of some sort (except assignments), it will print the result automatically. 

Neat for trying stuff out (and learning!). Now type '1 + 1' at the prompt you 

should still be at. What do you see? 2! Now ain't that a powerful language: <PRE>&gt;&gt;&gt; 1 + 1

2

</PRE>You can do this with any kind of variable or math expression (see part <A 

href="#math">3b</A>) 

and get some output. Works with strings too: <PRE>&gt;&gt;&gt; "elp! I'm being oppressed"

"elp! I'm being oppressed"

</PRE>Note the bad Monty Python reference :). Anyway, that's all for the 

interpreter. Now we get into the meat of things. If at any point there's a 

sample script and you don't feel like creating a new file for it, feel free to 

type (or better yet copy &amp; paste) it into the interpreter, it should work 

the same. Wait, scratch that :). If I put something in a script, it most likely 

means you only get the effect from a script and it won't work in interactive 

mode. Sorry. 

<P></P>

<P>Wait! One note before we leave. To quit the interpreter, you can't do 

anything fancy like type 'quit'. For some reason (beats me), that doesn't work. 

You have to type Ctrl+D to quit (on Unix at least, haven't tested it on 

Windows). Anyway if you type 'quit' it'll say something like 'Use Ctrl-D (i.e. 

EOF) to exit.' so listen to that. </P>

<P><FONT size=-2><A 

href="#top">Back 

to top</A></FONT></P>

<HR>



<H2 align=center><A name=first>Your First Program</A></H2>

<H3 align=center><A name=hello>Hello, World!</A></H3><BR>Alright, if you've ever 

read a programming tutorial before you know they all have some sort of program 

that just prints "Hello, World!" or something on the screen. Unfortunately, this 

tutorial is no different. Alright, here goes: <PRE>#!/usr/bin/python

#You only need the above line for Unix; replace that with your path to python



hello = "Hello, World!"

print hello

</PRE>That's it! Put that in a text file, name it hello.py, run it, and we're 

good. On Unix you may have to 'chmod +x hello.py' to run it, or just type 

'python hello.py'. Windows, I'm pretty sure .py files are associated with the 

Python interpreter automatically. 

<P></P>

<P><FONT size=-2><A 

href="#top">Back 

to top</A></FONT></P>

<HR>



<H3 align=center><A name=explain>Explanation</A></H3><BR>"Wow," you may be 

saying, "that was easy." Indeed it was. Now, though, you probably only have some 

remote clue of what's going on. We'll take it line by line. <PRE>#!/usr/bin/python

</PRE>This line, like you should've read, is only needed for Unix users. It 

tells your shell where the python executable is so it can run the script. <PRE>#You only need the above line for Unix; replace that with your path to python

</PRE>A pretty useless line, you may think, but it illustrates an important 

point: comments! Any good programmer knows that you need comments in your code, 

so just put # and anything after that on that line is a comment and will be 

ignored by the interpreter. <PRE>hello = "Hello, World!"

</PRE>I didn't really need this line, but I thought a Hello, World! script with 

only one line is kinda lame, so I added it anyway. hello is a string variable, 

which we'll talk about later, and the = operator assigns "Hello, World!" as its 

value. I'm sure if you've programmed before you've seen all this. <PRE>print hello

</PRE>This last line, as you may well guess, prints the contents of hello. If 

you're a perl guy (or girl :), you need to know that if you're printing a 

variable you can't put the name of the variable in quotes. But that's not too 

inconvenient, as we should see later. 

<P></P>

<P>Alright! Our first program! Now just a note or two before we move on. First, 

you may notice that there's nothing on the end of any lines, no ; like in perl 

or C. That's one of the convenient features of Python. I think it's more 

intuitive because blocks (later dammit!) are determined by indenting and every 

statement has its own line...you may disagree I guess but you'll just have to 

get used to it. </P>

<P><FONT size=-2><A 

href="#top">Back 

to top</A></FONT></P>

<HR>



<H2 align=center><A name=varmath>Variables and Math</A></H2>

<H3 align=center><A name=var>Variables: Strings, Numbers, etc.</A></H3><BR>In 

Python, just like any other language worth its salt, there are a number of data 

types, Mainly, there are numbers (of arbitrary precision), strings, lists, and 

tuples. Tuples are more of an "advanced" variable type, kind of like lists, so I 

won't go into them here, but I'll touch on them a bit in the <A 

href="#inter">Intermediate 

Python</A> section. 

<P></P>

<P>Numbers. What can I say? Numbers are numbers. To assign them, just like you 

did with the string in Hello World!, just put the name of your variable, the = 

operator, and what you want it to be: <PRE>&gt;&gt;&gt; a = 5

&gt;&gt;&gt;

</PRE>A word on variable names: I'm not quite sure exactly how long Python 

allows them to be (should I know?), but as a general rule you shouldn't have 

names more than 20 or so characters. Like other languages, variable names must 

be all alphanumeric characters and underscores (_), but you <I>can</I> start 

names with underscores, unlike some languages. 

<P></P>

<P>Anyway, on to strings. Strings store, obviously, strings of characters. 

Nothing you haven't heard before. For strings, you can use either type of quotes 

("" or ''), but be sure you know which kind. If you want to use, say, an 

apostrophe inside a string, you need to make sure of some things. If the string 

has "" quotes, don't worry about it, just put your apostraph. If you were in '' 

quotes, though, you would need to escape the apostrophe. This is so the 

interpreter doesn't think the apostrophe, which is just like a quote, is the end 

of your string. To escape the apostrophe, just put a \ (backslash) in front of 

the quote. Try it! It's great: <PRE>&gt;&gt;&gt; "I'm Dave"

"I'm Dave"

&gt;&gt;&gt; 'Python\'s my favorite language'

"Python's my favorite language"

&gt;&gt;&gt; "\"I can't think of anything else to say!\" he said"

'"I can\'t think of anything else to say!" he said'

&gt;&gt;&gt; 'That's too bad'

      File "&lt;stdin&gt;", line 1

    'That's too bad'

          ^

SyntaxError: invalid syntax

</PRE>Note the last two examples. The first one illustrates escaping of the "" 

quotes and also this: If you have both types of quotes in a string, Python will 

default to one and escape the other. Don't worry; if you're printing this to the 

screen it won't show the \ character in your output. In the last example, that's 

what happens when you don't escape quotes. You may notice Python has a nice way 

of handling errors, but we won't go into that. 

<P></P>

<P>Speaking of escaping, here are a few more characters you can escape (if it 

says 'n' then you use '\n' to escape it): 

<UL>

  <LI>n - Prints a newline, i.e. starts a new line. 

  <LI>t - Horizontal tab 

  <LI>b - Backslash. Deletes the last character typed 

  <LI>a - System beep 

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
裸体一区二区三区| 精品一区二区三区免费毛片爱 | 91伊人久久大香线蕉| 国产精品久线观看视频| 91最新地址在线播放| 亚洲综合丝袜美腿| 欧美人与性动xxxx| 毛片av一区二区| 国产肉丝袜一区二区| 国产在线不卡一区| 日韩一区欧美一区| 91久久精品午夜一区二区| 香港成人在线视频| 久久精品夜夜夜夜久久| 不卡大黄网站免费看| 一区二区久久久久| 日韩精品最新网址| 成人网在线免费视频| 一区二区三区在线视频免费观看 | 久久精品国产精品亚洲综合| 久久久不卡影院| 日本韩国精品在线| 麻豆精品蜜桃视频网站| 中文字幕一区二区三区在线播放| 在线精品视频一区二区| 精品中文字幕一区二区| 亚洲欧美综合色| 欧美另类videos死尸| 国产99久久久国产精品潘金 | 美国三级日本三级久久99| 国产三区在线成人av| 欧美三级韩国三级日本三斤 | 夜夜嗨av一区二区三区网页| 欧美变态tickling挠脚心| 91视频国产观看| 免费成人在线观看| 亚洲女爱视频在线| 日韩欧美中文一区| 色视频一区二区| 国产一区二区三区免费| 五月激情综合网| 中文字幕综合网| 2023国产精品自拍| 欧美日韩一区二区在线观看| 成人三级伦理片| 理论电影国产精品| 亚洲永久免费视频| 国产精品久久久久影院色老大| 欧美一级黄色大片| 欧美日韩精品欧美日韩精品| www.综合网.com| 国内成人精品2018免费看| 亚洲自拍偷拍麻豆| 17c精品麻豆一区二区免费| 精品福利在线导航| 欧美一区二区黄色| 欧美视频一区二区在线观看| 91农村精品一区二区在线| 国v精品久久久网| 国产在线精品一区在线观看麻豆| 日本不卡一区二区三区| 亚洲一线二线三线久久久| 国产精品传媒在线| 国产区在线观看成人精品| 日韩一区二区三区四区五区六区| 色综合天天在线| av电影天堂一区二区在线 | 17c精品麻豆一区二区免费| 国产午夜精品理论片a级大结局 | 91精品一区二区三区在线观看| 色噜噜狠狠成人中文综合| 91视频一区二区三区| 99久久久久久| 99精品视频一区二区三区| 国产91丝袜在线18| 国产乱子伦视频一区二区三区 | 五月天中文字幕一区二区| 性做久久久久久| 日本成人在线电影网| 久久成人免费电影| 国产一区二区精品久久91| 国产一区二区三区高清播放| 黄网站免费久久| 成人免费va视频| 92国产精品观看| 精品视频免费在线| 欧美大片在线观看| 日本一区二区在线不卡| 亚洲丝袜精品丝袜在线| 亚洲一区中文日韩| 麻豆91精品91久久久的内涵| 国产麻豆精品theporn| 成人午夜电影久久影院| 97se亚洲国产综合自在线观| 欧美视频日韩视频| 精品国产免费一区二区三区四区| 26uuu亚洲综合色| 国产精品久久久爽爽爽麻豆色哟哟| 日韩美女精品在线| 日本美女视频一区二区| 国产成人av一区二区三区在线| 大胆亚洲人体视频| 色婷婷av一区二区三区软件| 在线成人av影院| 久久久国产精华| 亚洲高清在线视频| 久久久久9999亚洲精品| 日韩伦理电影网| 美腿丝袜亚洲综合| 风间由美性色一区二区三区| 色综合中文字幕| 精品区一区二区| 亚洲色图视频网| 秋霞影院一区二区| 91亚洲精品乱码久久久久久蜜桃| 在线播放91灌醉迷j高跟美女| 久久久久99精品国产片| 亚洲国产成人91porn| 蜜臀va亚洲va欧美va天堂| 成人99免费视频| 日韩一区二区三区精品视频 | 欧美影片第一页| 久久久99免费| 日韩vs国产vs欧美| yourporn久久国产精品| 精品国产一区二区三区不卡| 亚洲激情第一区| 国产黄色精品网站| 91精品国产欧美一区二区成人 | 亚洲激情六月丁香| 国产高清在线精品| 欧美一区二区三区色| 久久精品久久综合| 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 在线观看成人小视频| 久久久亚洲精品一区二区三区| 亚洲一区二区三区四区五区黄| 岛国精品在线播放| 欧美xfplay| 麻豆精品久久精品色综合| 欧美日韩精品一区二区天天拍小说| 中文幕一区二区三区久久蜜桃| 青娱乐精品视频| 欧美色偷偷大香| 亚洲精品视频免费观看| 成人高清伦理免费影院在线观看| 日韩情涩欧美日韩视频| 午夜精品一区在线观看| 在线一区二区三区| 亚洲三级在线观看| 丁香一区二区三区| 26uuu亚洲| 国内国产精品久久| 26uuu亚洲综合色| 经典三级视频一区| 欧美成人免费网站| 青青草国产成人99久久| 欧美丰满少妇xxxxx高潮对白| 亚洲午夜在线观看视频在线| 99国产精品久久久久久久久久| 中文字幕免费一区| 成人国产视频在线观看| 国产精品情趣视频| 成人av一区二区三区| 国产精品人妖ts系列视频| 成人午夜激情影院| 国产精品国产三级国产普通话99| 成人午夜短视频| 亚洲色图.com| 日本精品视频一区二区三区| 亚洲国产日韩综合久久精品| 欧美三级日韩三级国产三级| 婷婷成人激情在线网| 91.xcao| 日产精品久久久久久久性色| 91精品啪在线观看国产60岁| 秋霞午夜鲁丝一区二区老狼| 日韩欧美电影一二三| 韩日av一区二区| 日本一区二区综合亚洲| 99久久国产免费看| 亚洲一区二区三区三| 在线电影欧美成精品| 久久99国产精品麻豆| 国产蜜臀97一区二区三区| av成人免费在线观看| 亚洲一区二区不卡免费| 欧美一二三区在线观看| 国模冰冰炮一区二区| 亚洲欧美在线另类| 欧美日韩精品一区二区三区四区 | 久久久91精品国产一区二区三区| 成人黄色片在线观看| 亚洲综合色婷婷| 精品三级在线看| 波多野结衣91| 日本sm残虐另类| 亚洲色图一区二区| 日韩欧美国产午夜精品| 99久久精品情趣|