id int64 0 25.6k | text stringlengths 0 4.59k |
|---|---|
9,400 | in this exampleif filename txt does not existan input/output exception called ioerror is generated on the other handif the file does existthere may be certain things that we want to do with it we can put those in the else block try/finally and with/as there is one more block you can use called finally things in the fin... |
9,401 | exceptions |
9,402 | published byjohn wiley sonsinc river streethobokennj - www wiley com copyright ( by john wiley sonsinc hobokennew jersey media and software compilation copyright ( by john wiley sonsinc all rights reserved published simultaneously in canada no part of this publication may be reproducedstored in retrieval system or tran... |
9,403 | introduction part igetting started with python talking to your computer getting your own copy of python interacting with python writing your first application part iitalking the talk storing and modifying information managing information making decisions performing repetitive tasks dealing with errors part iiiperformin... |
9,404 | introduction about this book foolish assumptions icons used in this book beyond the book where to go from here part igetting started with python talking to your computer understanding why you want to talk to your computer knowing that an application is form of communication thinking about procedures you use daily writi... |
9,405 | beginning programming with python for dummies interacting with python opening the command line starting python using the command line to your advantage using python environment variables to your advantage typing command telling the computer what to do telling the computer you're done seeing the result using help gettin... |
9,406 | defining the essential python data types putting information into variables understanding the numeric types understanding boolean values understanding strings working with dates and times managing information controlling how python views data making comparisons understanding how computers make comparisons working with ... |
9,407 | beginning programming with python for dummies processing data using the while statement understanding the while statement using the while statement in an application nesting loop statements dealing with errors knowing why python doesn' understand you considering the sources of errors classifying when errors occur disti... |
9,408 | managing lists organizing information in an application defining organization using lists understanding how computers view lists creating lists accessing lists looping through lists modifying lists searching lists sorting lists working with the counter object collecting all sorts of data understanding collections worki... |
9,409 | beginning programming with python for dummies reading file content updating file content deleting file sending an -mail understanding what happens when you send -mail viewing -mail as you do letter defining the parts of the envelope defining the parts of the letter creating the -mail message working with text message w... |
9,410 | ten interesting tools tracking bugs with roundup issue tracker creating virtual environment using virtualenv installing your application using pyinstaller building developer documentation using pdoc developing application code using komodo edit debugging your application using pydbgr entering an interactive environment... |
9,411 | beginning programming with python for dummies |
9,412 | uickwhich programming language will get you up and running writing applications on every popular platform aroundgive upyesit' python the amazing thing about python is that you really can write an application on one platform and use it on every other platform that you need to support unlike the other programming languag... |
9,413 | beginning programming with python for dummies performing tasks such as sending an -mail using python noyou won' be an expertbut you will be able to use python to meet specific needs in the job environment to make absorbing the concepts even easierthis book uses the following conventionstext that you're meant to type ju... |
9,414 | icons used in this book as you read this bookyou see icons in the margins that indicate material of interest (or notas the case may bethis section briefly describes each icon in this book tips are nice because they help you save time or perform some task without lot of extra work the tips in this book are time-saving t... |
9,415 | beginning programming with python for dummies dummies com online articlesa lot of readers were skipping past the parts pages in the bookso decided to remedy that you now have really good reason to read the parts pagesand that' online content every parts page has an article associated with it that provides additional in... |
9,416 | getting started with python visit www dummies com for great dummies content online |
9,417 | discover what programming is all about and why you need python to do it get your own copy of python and install it on your system work with the interactive environment that python provides create your first application using python understand the benefits of adding comments to your application |
9,418 | talking to your computer in this talking to your computer creating programs to talk to your computer understanding what program does and why you want to create it considering why you want to use python as your programming language aving conversation with your computer might sound like the script of science fiction movi... |
9,419 | part igetting started with python reading your -mail writing about your vacation finding the greatest gift in the world are all examples of communication that occurs between computer and you that the computer further communicates with other machines or people to address requests that you make simply extends the basic i... |
9,420 | knowing that an application is form of communication computer communication occurs through the use of applications you use one application to answer your -mailanother to purchase goodsand still another to create presentation an application (sometimes called an appprovides the means to express human ideas to the compute... |
9,421 | part igetting started with python place each piece of bread in its own slot push the toaster lever down to start toasting the bread wait for the toasting process to complete remove toast from the toaster place toast on plate butter the toast your procedure might vary from the one presented herebut it' unlikely that you... |
9,422 | works completelybut eventually you can create one writing procedures down isn' really sufficientthough -you also need to test the procedure by using someone who isn' familiar with the task involved when working with computersthe computer is your perfect test subject seeing applications as being like any other procedure... |
9,423 | part igetting started with python defining what an application is as previously mentionedapplications provide the means to define express human ideas in manner that computer can understand to accomplish this goalthe application relies on one or more procedures that tell the computer how to perform the tasks related to ... |
9,424 | helping humans speak to the computer it' important to keep the purpose of an application in mind as you write it an application is there to help humans speak to the computer in certain way every application works with some type of data that is inputstoredmanipulatedand output so that the humans using the application ob... |
9,425 | part igetting started with python you can also start to think about the ways in which you work start writing procedures for the things you do it' good idea to take the process one step at time and write everything you can think of about that step when you get finishedask someone else to try your procedure to see how it... |
9,426 | unearthing the reasons for using python most programming languages are created with specific goals in mind these goals help define the language characteristics and determine what you can do with the language there really isn' any way to create programming language that does everything because people have competing goal... |
9,427 | part igetting started with python deciding how you can personally benefit from python ultimatelyyou can use any programming language to write any sort of application you want if you use the wrong programming language for the jobthe process will be slowerror pronebug riddenand you'll absolutely hate it -but you can get ... |
9,428 | developing user interfacespython isn' like some languages like cwhere you have built-in designer and can drag and drop items from toolbox onto the user interface howeverit does have an extensive array of graphical user interface (guiframeworks -extensions that make graphics lot easier to create (see org/moin/guiprogram... |
9,429 | part igetting started with python yahooyoutube zope digital creations (application these are just few of the many organizations that use python extensively you can find more complete list of organizations at org/about/successthe number of success stories has become so large that even this list probably isn' complete an... |
9,430 | that also use number of languages and find at least some level of overlap among them all there is no best language in the worldsimply the language that works best for particular application with this idea in mindthe following sections provide an overview comparison of python to other languages (you can find comparisons... |
9,431 | part igetting started with python perl perl was originally an acronym for practical extraction and report language todaypeople simply call it perl and let it go at that howeverperl still shows its roots in that it excels at obtaining data from database and presenting it in report format of courseperl has been extended ... |
9,432 | getting your own copy of python in this obtaining copy of python for your system performing the python installation finding and using python on your system ensuring your installation works as planned reating applications requires that you have another applicationunless you really want to get low level and write applica... |
9,433 | part igetting started with python application system (as/ beos hewlett-packard unix (hp-uxlinux mac os (comes pre-installed with the osmicrosoft disk operating system (ms-dosmorphos operating system (os/ operating system (os/ and /os palmos playstation psion qnx risc os (originally acornseries solaris virtual memory sy... |
9,434 | you with the default setup that is used in this book the platform-specific links on the left side of the page show you alternative python configurations that you can use when the need arises for exampleyou may want to use more advanced editor than the one provided with the default python packageand these alternative co... |
9,435 | part igetting started with python figure - volunteers have made python available on all sorts of platforms installing python after you download your copy of pythonit' time to install it on your system the downloaded file contains everything needed to get you startedpython interpreter help files (documentationcommand-li... |
9,436 | this book assumes that you're using one of the default python setups found at supported by this bookwindowsmac os xand linux working with windows the installation process on windows system follows the same procedure that you use for other application types the main difference is in finding the file you downloaded so th... |
9,437 | part igetting started with python choose user installation option (the book uses the default setting of install for all usersand click next install asks you to provide the name of an installation directory for pythonas shown in figure - using the default destination will save you time and effort later howeveryou can in... |
9,438 | figure - customize your instal lation to meet your needs (optionalclick the down arrow next to the add python exe to path option and choose the will be installed on local drive option click next you see the installation process start at some pointyou might see user account control dialog box asking whether you want to ... |
9,439 | part igetting started with python the leopard version of os ( uses really old version of python this particular version lacks direct access to the idle application as resultyou may find that some book exercises won' work properly the article at about how to overcome this particular issue the newest version of os at the... |
9,440 | select the volume (hard drive or other mediathat you want to use for installing python and click continue the installation type dialog box appears this dialog box performs two tasksclick customize to change the feature set that is installed on your system click change install location to modify the place where the inst... |
9,441 | part igetting started with python using the standard linux installation the standard linux installation works on any system howeverit requires you to work at the terminal and type commands to complete it some of the actual commands may vary by version of linux the information at docs python org/ /installprovides some h... |
9,442 | type sudo apt-get install libbz -dev and press enter linux installs the bzip support required by python for archive manipulation (see details type cd python in the terminal window and press enter terminal changes directories to the python folder on your system type /configure and press enter the script begins by checki... |
9,443 | part igetting started with python click install ubuntu begins the process of installing python progress bar shows the download and installation status when the installation is completethe install button changes to remove button close the ubuntu software center folder you see python icon added to the desktop python is r... |
9,444 | clicking idle (python guiproduces graphical interactive environment like the one shown in figure - when you open this environmentidle automatically displays some information so that you know you have the right application open for exampleyou see the python version number (which is in this caseit also tells you what sor... |
9,445 | part igetting started with python third method to access python is to open command prompttype pythonand press enter you can use this approach when you want to gain additional flexibility over the python environmentautomatically load itemsor execute python in higher-privilege environment (in which you gain additional se... |
9,446 | at adding python-specific environment variables such as pythonstartup pythonpath pythonhome pythoncaseok pythonioencoding pythonfaulthandler pythonhashseed none of these environment variables is used in the book howeveryou can find out more about them at cmdline html#environment-variables using the mac when working wit... |
9,447 | part igetting started with python double-clicking idle application opens graphical interactive environment that looks similar to the environment shown in figure - there are some small cosmetic differencesbut the content of the window is the same doubleclicking python launcher opens command-line environment similar to t... |
9,448 | figure - the print(command displays whatever information you tell it to print notice that idle color codes the various entries for you so that they're easier to see and understand the colors codes are your indicator that you've done something right four color codes are shown in figure - (although they're not visible in... |
9,449 | part igetting started with python it' time to end your idle session type quitand press enter idle may display message such as the one shown in figure - wellyou never intended to kill anythingbut you will now click okand the session dies figure - idle seems to get little dramatic about ending sessionnotice that the quit... |
9,450 | interacting with python in this accessing the command line using commands to perform tasks obtaining help about python ending command-line session ltimatelyany application you create interacts with the computer and the data it contains the focus is on data because without datathere isn' good reason to have an applicati... |
9,451 | part igetting started with python understanding the importance of the readme file many applications include readme file the readme file usually provides updated informa tion that didn' make it into the documentation before the application was put into produc tion status unfortunatelymost people ignore the readme file a... |
9,452 | starting python depending on your platformyou might have multiple ways to start the command line here are the methods that are commonly availableselect the python (command-lineoption found in the python folder this option starts command-line session that uses the default settings open command prompt or terminaltype pyt... |
9,453 | part igetting started with python using the command line to your advantage this section will seem little complicated at firstand you won' normally need this information when using the book howeverit' still good informationand you'll eventually need it for nowyou can browse the information so that you know what' availab... |
9,454 | - cmduse the information provided by cmd to start program this option also tells python to stop processing the rest of the information as options (it' treated as part of the command-dstart the debugger (used to locate errors in your application-eignore all the python environment variablessuch as pythonpaththat are used... |
9,455 | part igetting started with python -xskip the first line of source code filewhich allows the use of nonunix forms of #!cmd - optset an implementation-specific option (the documentation for your version of python discusses these optionsif there are any using python environment variables to your advantage environment vari... |
9,456 | pythonfaulthandler=xforces python to dump the python traceback (list of calls that led to an erroron fatal errors pythonhashseed=argdetermines the seed value used to generate hash values from various kinds of data when this variable is set to randompython uses random value to seed the hashes of strbytesand datetime obj... |
9,457 | part igetting started with python telling the computer what to do pythonlike every other programming language in existencerelies on commands command is simply step in procedure in you saw how "get the bread and butter from the refrigeratoris step in procedure for making toast when working with pythona commandsuch as pr... |
9,458 | point sotake look at how this works the following procedure helps you see the result of using command start copy of the python command-line version you see command prompt where you can type commandsas shown in figure - type print("this is line of text "at the command line notice that nothing happens yesyou typed comman... |
9,459 | part igetting started with python using help python is computer languagenot human language as resultyou won' speak it fluently at first if you think about it for momentit makes sense that you won' speak python fluently (and as with most human languagesyou won' know every command even after you do become fluenthaving to... |
9,460 | who put python together the license(command describes the usage agreement between you and the copyright holder howeverthe command you most want to know about is simply help(to enter help modetype helpand press enter notice that you must include the parentheses after the command even though they don' appear in the help ... |
9,461 | part igetting started with python the first two topics won' tell you much for now you won' need the modules topic until the keywords topic will begin proving useful in howeverthe topics keyword is already useful because it helps you understand where to begin your python adventure to see what topics are availabletype to... |
9,462 | as you work through examples in the bookyou use commands that look interestingand you might want more information about them for examplein the "seeing the resultsection of this you use the print(command to see more information about the print(commandtype print and press enter (notice that you don' include the parenthes... |
9,463 | part igetting started with python you may still not find the information as helpful as you needbut at least you know little more in this casehelp has lot to say and it can' all fit on one screen notice the following entry at the bottom of the screen-more -to see the additional informationpress the spacebar the next pag... |
9,464 | single quotewhatever you want to findanother single quoteand the right parenthesis for exampleif you want to know more about the print(commandyou type help('print'and press enter figure - shows typical output when you access help this way figure - python makes it possible to obtain help whenever you need it without lea... |
9,465 | part igetting started with python you might wonder why python has help mode at all if you can get the same results at the python prompt the answer is convenience it' easier to browse in the help mode in additioneven though you don' do lot of extra typing at the promptyou do perform less typing while in help mode help m... |
9,466 | type quit( and press enter you see the prompt again type echo %errorleveland press enter you see the error codeas shown in figure - when working with platforms other than windowsyou may need to type something other than echo %errorlevelfor examplewhen working with bash scriptyou type echo instead figure - add an error ... |
9,467 | part igetting started with python both of these commands are used in emergency situations only the firstsys exit()provides special error-handling features that you discover in the secondos _exit()exits python without performing any of the usual cleanup tasks in both casesyou must import the required moduleeither sys or... |
9,468 | writing your first application in this working with the integrated development environment (idlegetting started with idle writing the first application seeing how the first application works formatting your application code using comments effectively working with existing applications ending your idle session any peopl... |
9,469 | part igetting started with python vast number of other tools are available for you to use when writing python applications this book doesn' tell you much about them because idle performs every task needed and it comes with python howeveras your skills increaseyou might find that tools such as komodo edit (activestate c... |
9,470 | starting idle you find idle in the python folder on your system as idle (python guiwhen you click or double-click this entry (depending on your platform)you see the idle editor shown in figure - the two lines of text contain information about the python host and provide suggestions on the commands you can try the preci... |
9,471 | part igetting started with python using standard commands idle provides all the same commands as the command-line version of python it doesn' list them all because the assumption is that you'll use the gui features of idle to make things easy howeverif you wantyou can type helpand press enter to enter help modeeven tho... |
9,472 | understanding color coding the book doesn' show the color coding that you see when you type help)but you can see it in the editor color coding lets you see commands with greater ease and differentiate commands from other sorts of text press enter to get out of help mode as with the command-line versionyou see descripti... |
9,473 | part igetting started with python getting gui help idle makes obtaining the help you need easy look at the help menu and you see three entries for obtaining helpabout idleprovides you with the latest information about idle idle helpshows you text file containing information about working with the idle ide for exampleth... |
9,474 | figure - use python docs to dis cover more about using python to create applications configuring idle idle is basically fancy text editorwhen you think about itso it' not surprising that you can configure it to perform the task of editing text better choose optionsconfigure idle to see the idle preferences dialog box s... |
9,475 | part igetting started with python figure - configure idle to meet your particular require ments figure - change the highlighting used for text so that you can see it better |
9,476 | even though you won' see shortcut keys used very often in this book due to platform differencesidle does support them the shortcut keys on your platform may differ from those shown in figure - idle comes with builtin key sets for windowsmacos xand unix you can choose any of these themes by clicking the small button nex... |
9,477 | part igetting started with python figure - the general tab controls the func tioning of the idle application the additional help sources feature lets you create new help sources for idle to use for exampleyou can create link to an online sourcesuch as python' online documentation at add new sourceclick add you see the ... |
9,478 | creating the application it' time to create your first python application your initial python shell window won' work for creating an applicationso you can begin by creating new edit window for the application you'll type the required commands and then save the file to disk opening new window the initial python shell wi... |
9,479 | part igetting started with python the edit window also provides special commands to format the text the "understanding the use of indentationand "adding commentssections of this describe how to use the formatting features what you need to know now is that these formatting commands act differently from those in standard... |
9,480 | finish the command by typing "this is simple python application and pressing enter your application should look like the one shown in figure - this is one of the simplest applications you can create using python figure - complete application can be quite short saving the file you could run the application now if you wa... |
9,481 | part igetting started with python type firstapp py in the filename field of the save as dialog box and click save your application code is now saved on disk and you can access it anytime you want figure - the save as dialog box provides the means for saving your application when you return to the edit windowthe title b... |
9,482 | running the application applications aren' much good if you can' run them python provides variety of methods for running any application you create this section explores the easiest method for running an application after you create it you see additional methods in the "loading and running existing applicationssection ... |
9,483 | part igetting started with python figure - the python shell window displays restart message each time you run the application understanding the use of indentation as you work through the examples in this bookyou see that certain lines are indented in factthe examples also provide fair amount of white space (such as ext... |
9,484 | as shown in figure - this feature is called automatic indention and it' one of the features that differentiates regular text editor from one designed to write code type "appear on multiple lines in the source code file "and press enter notice that the insertion point goes back to the beginning of the line when idle sen... |
9,485 | part igetting started with python adding comments people create notes for themselves all the time when you need to buy groceriesyou look through your cabinetsdetermine what you needand write it down on list when you get to the storeyou review your list to remember what you need using notes comes in handy for all sorts ... |
9,486 | even though single-line and multiline comments are both commentsthe idle editor makes it easy to tell the difference between the two when you're using the default color schemesingle-line comments show up in red textwhile multiline comments show up in green text python doesn' care about the colorationit' only there to h... |
9,487 | part igetting started with python how this feature works say that you have an application like the one shown in figure - (found in the comments py file provided as part of the downloadable source codefigure - sometimes developers need to comment out lines of code you might want to comment out the line that reads print(... |
9,488 | of courseyou don' know yet whether the commenting has worked save the file to disk and then choose runrun module you see new python shell window open with just single line of outputas shown in figure - sothe first print(commandwhich isn' commented outexecutes just finebut the second one doesn' figure - commented out li... |
9,489 | part igetting started with python loading and running existing applications running your application immediately after you write it is fun and interestingbut at some point you'll close idle and be left with file on your disk the file contains your applicationbut you need to know how to use that file to execute it pytho... |
9,490 | using the edit window any time you're in idleyou can open an existing application in an edit window and execute itjust as you have in previous sections of this to perform this taskload the file you saved earlier by choosing fileopen you see an open dialog box that looks similar to the save as dialog box shown in figure... |
9,491 | part igetting started with python figure - use forward slashes or backslashes to define the loca tion of your application closing idle eventuallyyou need to close idle when your session is finished the commands for closing idle appear on the file menuand there are actually two of them (which seems bit confusing)closecl... |
9,492 | talking the talk see an example of how you can combine functions and repetitive tasks at www dummies com/extras/beginningprogramming withpython |
9,493 | see how to create variables to hold data create functions to make code easier to read tell your python application to make decision perform repeating tasks ensure that your application can deal with errors |
9,494 | storing and modifying information in this understanding data storage considering the kinds of data storage adding dates and times to applications hapter introduces you to crudcreatereadupdateand delete -not that contains cruddy material this acronym provides an easy method to remember precisely what tasks all computer ... |
9,495 | part iitalking the talk seeing variables as storage boxes when working with applicationsyou store information in variables variable is kind of storage box whenever you want to work with the informationyou access it using the variable if you have new information you want to storeyou put it in variable changing informati... |
9,496 | defining the essential python data types every programming language defines variables that hold specific kinds of informationand python is no exception the specific kind of variable is called data type knowing the data type of variable is important because it tells you what kind of information you find inside in additi... |
9,497 | part iitalking the talk because each form requires different kind of processing the following sections describe the integerfloating-pointand complex number classes of data types that python supports integers any whole number is an integer for examplethe value is whole numberso it' an integer on the other hand isn' whol... |
9,498 | figure - integers have many interesting featuresincluding the capabil ity to use different numeric bases floating-point values any number that includes decimal portion is floating-point value for example has decimal partso it' floating-point value many people get confused about whole numbers and floating-point numbersb... |
9,499 | part iitalking the talk figure - floatingpoint values provide multiple assignment techniques complex numbers you may or may not remember complex numbers from school complex number consists of real number and an imaginary number that are paired together just in case you've completely forgotten about complex numbersyou c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.