id
int64
0
25.6k
text
stringlengths
0
4.59k
9,700
the animal class tracks three characteristicsnameageand type production application would probably track more characteristicsbut these characteristics do everything needed for this example the code also includes the required accessors for each of the characteristics the __str__(method completes the picture by printing simple message stating the animal characteristics the chicken class inherits from the animal class notice the use of animal in parentheses after the chicken class name this addition tells python that chicken is kind of animalsomething that will inherit the characteristics of animal notice that the chicken constructor accepts only name and age the user doesn' have to supply type value because you already know that it' chicken this new constructor overrides the animal constructor the three attributes are still in placebut type is supplied directly in the chicken constructor someone might try something funnysuch as setting her chicken up as gorilla with this in mindthe chicken class also overrides the settype(setter if someone tries to change the chicken typethat user gets message rather than the attempted change normallyyou handle this sort of problem by using an exceptionbut the message works better for this example by making the coding technique clearer finallythe chicken class adds new featuremakesound(whenever someone wants to hear the sound chicken makeshe can call makesound(to at least see it printed on the screen testing the class in an application testing the chicken class also tests the animal class to some extent some functionality is differentbut some classes aren' really meant to be used the animal class is simply parent for specific kinds of animalssuch as chicken the following steps demonstrate the chicken class so that you can see how inheritance works this example also appears with the downloadable source code as liststack py open python file window you see an editor in which you can type the example code
9,701
type the following code into the window -pressing enter after each lineimport animals mychicken animals chicken("sally" print(mychickenmychicken setage(mychicken getage( print(mychickenmychicken settype("gorilla"print(mychickenmychicken makesound(the first step is to import the animals module remember that you always import the filenamenot the class the animals py file actually contains two classes in this caseanimal and chicken the example creates chickenmychickennamed sallywho is age it then starts to work with mychicken in various ways for examplesally has birthdayso the code updates sally' age by notice how the code combines the use of settersetage()with gettergetage()to perform the task after each changethe code displays the resulting object values for you the final step is to let sally say few words choose runrun module you see each of the steps used to work with mychickenas shown in figure - as you can seeusing inheritance can greatly simplify the task of creating new classes when enough of the classes have commonality so that you can create parent class that contains some amount of the code figure - sally has birthday and then says few words
9,702
performing advanced tasks see an example of how you can interact with the directory structure of your plat form at www dummies com/extras/beginningprogrammingwith python
9,703
create file read file update file delete file send an email
9,704
storing data in files in this considering how permanent storage works with applications deciding how to work with permanently stored content writing to file for the first time obtaining content from the disk changing file content as needed removing file from disk ntil nowapplication development might seem to be all about presenting information onscreen actuallyapplications center around need to work with data in some way data is the focus of all applications because it' the data that users are interested in be prepared for huge disappointment the first time you present treasured application to user base and find that the only thing users worry about is whether the application will help them leave work on time after creating presentation the fact isthe best applications are invisiblebut they present data in the most appropriate manner possible for user' needs if data is the focus of applicationsthen storing the data in permanent manner is equally important for most developersdata storage revolves around permanent media such as hard drivesolid state drive (ssd)universal serial bus (usbflash driveor some other methodology (even cloud-based solutions work finebut you won' see them used in this book because they require different programming techniques that are beyond the book' scope the data in memory is temporary because it lasts only as long as the machine is running permanent storage device holds onto the data long after the machine is turned off so that it can be retrieved during the next session in addition to permanent storagethis also helps you understand the four basic operations that you can perform on filescreatereadupdateand delete (crudyou see the crud acronym used quite often in database circlesbut it applies equally well to any application no matter how your application stores the data in permanent locationit must be able to perform these four tasks in order to provide complete solution to the user of course
9,705
crud operations must be performed in securereliableand controlled manner this also helps you set few guidelines for how access must occur to ensure data integrity ( measure of how often data errors occur when performing crud operationsunderstanding how permanent storage works you don' need to understand absolutely every detail about how permanent storage works in order to use it for examplejust how the drive spins (assuming that it spins at allis unimportant howevermost platforms adhere to basic set of principles when it comes to permanent storage these principles have developed over period of timestarting with mainframe systems in the earliest days of computing data is stored in files you probably know about files already because every useful application out there relies on them for examplewhen you open document in your word processoryou're actually opening data file containing the words that you or someone else has typed files typically have an extension associated with them that defines the file type the extension is generally standardized for any given application and is separated from the filename by periodsuch as mydata txt in this casetxt is the file extensionand you probably have an application on your machine for opening such files in factyou can likely choose from number of applications to perform the task because the txt file extension is relatively common internallyfiles structure the data in some specific manner to make it easy to write and read data to and from the file any application you write must know about the file structure in order to interact with the data the file contains the examples in this use simple file structure to make it easy to write the code required to access thembut file structures can become quite complex files would be nearly impossible to find if you placed them all in the same location on the hard drive consequentlyfiles are organized into directories many newer computer systems also use the term folder for this organizational feature of permanent storage no matter what you call itpermanent storage relies on directories to help organize the data and make individual files significantly easier to find to find particular file so that you can open it and interact with the data it containsyou must know which directory holds the file directories are arranged in hierarchies that begin at the uppermost level of the hard drive for examplewhen working with the downloadable source code for this bookyou find the code for the entire book in the bp
9,706
directory howeverthis directory doesn' actually contain any source code files to locate the source code filesyou must open one of the directories contained in the bp directory first to locate the source code files for this you look in the bp ddirectory notice that 've used backslash (\to separate the directory levels some platforms use the forward slash (/)while others use the backslash you can read about this issue on my blog at com//backslash-versus-forward-slashthe book uses backslashes when appropriate and assumes that you'll make any required changes for your platform final consideration for python developers (at least for this bookis that the hierarchy of directories is called path you see the term path in few places in this book because python must be able to find any resources you want to use based on the path you provide for examplec:bp dis the complete path to the source code for this on windows system path that traces the entire route that python must search is called an absolute path an incomplete path that traces the route to resource using the current directory as starting point is called relative path creating content for permanent storage file can contain structured or unstructured data an example of structured data is database in which each record has specific information in it an employee database would include columns for nameaddressemployee idand so on each record would be an individual employee and each employee record would contain the nameaddressand employee id fields an example of unstructured data is word processing file whose text can contain any content in any order there is no required order for the content of paragraphand sentences can contain any number of words howeverin both casesthe application must know how to perform crud operations with the file this means that the content must be prepared in such manner that the application can both write to and read from the file even with word processing filesthe text must follow certain series of rules assume for moment that the files are simple text even soevery paragraph must have some sort of delimiter telling the application to begin new paragraph the application reads the paragraph until it sees this delimiterand then it begins new paragraph the more that the word processor offers in the way of featuresthe more structured the output becomes for examplewhen the word processor offers method of formatting the textthe formatting must appear as part of the output file
9,707
the cues that make content usable for permanent storage are often hidden from sight all you see when you work with the file is the data itself the formatting remains invisible for number of reasonssuch as thesethe cue is control charactersuch as carriage return or linefeedthat is normally invisible by default at the platform level the application relies on special character combinationssuch as commas and double quotesto delimit the data entries these special character combinations are consumed by the application during reading part of the reading process converts the character to another formsuch as when word processing file reads in content that is formatted the formatting appears onscreenbut in the background the file contains special characters to denote the formatting the file is actually in an alternative formatsuch as extensible markup language (xml(see asp for information about xmlthe alternative format is interpreted and presented onscreen in manner the user can understand other rules likely exist for formatting data for examplemicrosoft actually uses zip file to hold its latest word processing files (the docxfile the use of compressed file catalogsuch as zipmakes storing great deal of information in small space possible it' interesting to see how others store data because you can often find more efficient and secure means of data storage for your own applications now that you have better idea of what could happen as part of preparing content for disk storageit' time to look at an example in this casethe formatting strategy is quite simple all this example does is accept inputformat it for storageand present the formatted version onscreen (rather than save it to disk just yetthis example also appears with the downloadable source code as formatteddata py (which contains the class used to format the informationand formatteddatatest py (which outputs the data onscreen open python file window you see an editor in which you can type the example code type the following code into the window -pressing enter after each lineclass formatdatadef __init__(selfname=""age= married=false)self name name self age age self married married
9,708
def __str__(self)outstring "'{ }'{ }{ }formatself nameself ageself marriedreturn outstring this is shortened class normallyyou' add accessors (getter and setter methodsand error-trapping code (remember that getter methods provide read-only access to class data and setter methods provide write-only access to class data howeverthe class works fine for the demonstration the main feature to look at is the __str__(function notice that it formats the output data in specific way the string valueself nameis enclosed in single quotes each of the values is also separated by comma this is actually form of standard output formatcomma-separated value (csv)that is used on wide range of platforms because it' easy to translate and is in plain textso nothing special is needed to work with it save the code as formatteddata py open another python file window type the following code into the window -pressing enter after each linefrom formatteddata import formatdata newdata [formatdata("george" true)formatdata("sally" false)formatdata("doug" true)for entry in newdataprint(entrythe code begins by importing just the formatdata class from formatteddata in this caseit doesn' matter because the formatteddata module contains only single class howeveryou need to keep this technique in mind when you need only one class from module most of the timeyou work with multiple records when you save data to disk you might have multiple paragraphs in word processed document or multiple recordsas in this case the example creates list of records and places them in newdata in this casenewdata represents the entire document the representation will likely take other forms in production applicationbut the idea is the same
9,709
any application that saves data goes through some sort of output loop in this casethe loop simply prints the data onscreen howeverin the upcoming sectionsyou actually output the data to file choose runrun module you see the output shown in figure - this is representation of how the data would appear in the file in this caseeach record is separated by carriage return and linefeed control character combination that isgeorgesallyand doug are all separate records in the file each field (data elementis separated by comma text fields appear in quotes so that they aren' confused with other data types figure - the example presents how the data might look in csv format creating file any data that the user creates and wants to work with for more than one session must be put on some sort of permanent media creating file and then placing the data into it is an essential part of working with python you can use the following steps to create code that will write data to the hard drive this example also appears with the downloadable source code as formatteddata py and createcsv py open the previously saved formatteddata py file you see the code originally created in the "creating content for permanent storagesectionearlier in this appear onscreen this example makes modifications to the original code so that the class can now save file to disk add the following import statement to the top of the fileimport csv the csv module contains everything needed to work with csv files
9,710
python actually supports huge number of file types nativelyand libraries that provide additional support are available if you have file type that you need to support using pythonyou can usually find third-party library to support it when python doesn' support it natively unfortunatelyno comprehensive list of supported files existsso you need to search online to find how python supports the file you need the documentation divides the supported files by types and doesn' provide comprehensive list for exampleyou can find all the archive formats at html and the miscellaneous file formats at org/ /library/fileformats html type the following code into the window at the end of the existing code -pressing enter after each linedef savedata(filename ""datalist [])with open(filename" "newline='\ 'as csvfiledatawriter csv writercsvfiledelimiter='\ 'quotechar="quoting=csv quote_nonnumericdatawriter writerow(datalistcsvfile close(print("data saved!"make absolutely certain that savedata(is properly indented if you add savedata(to the file but don' indent it under the formatdata classpython will treat the function as separate function and not as part of formatdata the easiest way to properly indent the savedata(function is to follow the same indentation used for the __init__(and __str__(functions notice that the method accepts two arguments as inputa filename used to store the data and list of items to store this is class method rather than an instance method later in this procedureyou see how using class method is an advantage the datalist argument defaults to an empty list so that if the caller doesn' pass anything at allthe method won' throw an exception insteadit produces an empty output file of courseyou can also add code to detect an empty list as an errorif desired the with statement tells python to perform series of tasks with specific resource -an open csvfile named testfile csv the open(function accepts number of inputs depending in how you use it for this exampleyou open it in write mode (signified by the wthe newline attribute tells python to treat the \ control character (linefeedas newline character
9,711
in order to write outputyou need writer object the datawriter object is configured to use csvfile as the output fileto use / as the record characterto quote records using spaceand to provide quoting only on nonnumeric values this setup will produce some interesting results laterbut for nowjust assume that this is what you need to make the output usable actually writing the data takes less effort than you might think single call to datawriter writerow(with the datalist as input is all you need always close the file when you get done using it this action flushes the data (makes sure that it gets writtento the hard drive the code ends by telling you that the data has been saved save the code as formatteddata py open new python file window you see an editor in which you can type the example code type the following code into the window -pressing enter after each linefrom formatteddata import formatdata newdata [formatdata("george" true)formatdata("sally" false)formatdata("doug" true)formatdata savedata("testfile csv"newdatathis example should look similar to the one you created in the "creating content for permanent storagesectionearlier in the you still create newdata as list howeverinstead of displaying the information onscreenyou send it to file instead by calling formatdata savedata(this is one of those situations in which using an instance method would actually get in the way to use an instance methodyou would first need to create an instance of formatdata that wouldn' actually do anything for you choose runrun module the application runsand you see data saved message as output of coursethat doesn' tell you anything about the data in the source code fileyou see new file named testfile csv most platforms have default application that opens such file with windowsyou can open it using excel and wordpad (among other applicationsfigure - shows the output in excelwhile figure - shows it in wordpad in both casesthe output looks surprisingly similar to the output shown in figure -
9,712
figure - the appli cation output as it appears in excel figure - the appli cation output as it appears in wordpad reading file content at this pointthe data is on the hard drive of courseit' nice and safe therebut it really isn' useful because you can' see it to see the datayou must read it into memory and then do something with it the following steps show how to read data from the hard drive and into memory so that you can display it onscreen this example also appears with the downloadable source code as formatteddata py and readcsv py open the previously saved formatteddata py file you see the code originally created in the "creating filesectionearlier in this appear onscreen this example makes modifications to the original code so that the class can now save file to disk
9,713
type the following code into the window at the end of the existing code -pressing enter after each linedef readdata(filename "")with open(filename" "newline='\ 'as csvfiledatareader csv readercsvfiledelimiter="\ "quotechar="quoting=csv quote_nonnumericoutput [for item in datareaderoutput append(item[ ]csvfile close(print("data read!"return output as previously mentionedmake absolutely certain that readdata(is properly indented if you add readdata(to the file but don' indent it under the formatdata classpython will treat the function as separate function and not as part of formatdata the easiest way to properly indent readdata(is to follow the same indentation used for the __init__(and __str__(functions opening file for reading is much like opening it for writing the big difference is that you need to specify (for readinstead of (for writeas part of the csv reader(constructor otherwisethe arguments are precisely the same and work the same it' important to remember that you're starting with text file when working with csv file yesit has delimitersbut it' still text when reading the text into memoryyou must rebuild the python structure in this caseoutput is an empty list when it starts the file currently contains three records that are separated by the / control character python reads each record in using for loop notice the odd use of item[ when python reads the recordit sees the nonterminating entries (those that aren' last in the fileas actually being two list entries the first entry contains datathe second is blank you want only the first entry these entries are appended to output so that you end up with complete list of the records that appear in the file as beforemake sure that you close the file when you get done with it the method prints data read message when it finishes it then returns output ( list of recordsto the caller save the code as formatteddata py open python file window you see an editor in which you can type the example code
9,714
type the following code into the window -pressing enter after each linefrom formatteddata import formatdata newdata formatdata readdata("testfile csv"for entry in newdataprint(entrythe readcsv py code begins by importing the formatdata class it then creates newdata objecta listby calling formatdata readdata(notice that the use of class method is the right choice in this case as well because it makes the code shorter and simpler the application then uses for loop to display the newdata content choose runrun module you see the output shown in figure - notice that this output looks similar to the output in figure - even though the data was written to disk and read back in this is how applications that read and write data are supposed to work the data should appear the same after you read it in as it did when you wrote it out to disk otherwisethe application is failure because it has modified the data figure - the applica tion input after it has been processed updating file content some developers treat updating file as something complex it can be complex if you view it as single task howeverupdates actually consist of three activities read the file content into memory modify the in-memory presentation of the data write the resulting content to permanent storage
9,715
in most applicationsyou can further break down the second step of modifying the in-memory presentation of the data an application can provide some or all of these features as part of the modification processprovide an onscreen presentation of the data allow additions to the data list allow deletions from the data list make changes to existing datawhich can actually be implemented by adding new record with the changed data and deleting the old record so far in this you have performed all but one of the activities in these two lists you've already read file content and written file content in the modification listyou've added data to list and presented the data onscreen the only interesting activity that you haven' performed is deleting data from list the modification of data is often performed as two-part process of creating new record that starts with the data from the old record and then deleting the old record after the new record is in place in the list don' get into rut by thinking that you must perform every activity mentioned in this section for every application monitoring program wouldn' need to display the data onscreen in factdoing so might be harmful (or at least inconvenienta data logger only creates new entries -it never deletes or modifies them an -mail application usually allows the addition of new records and deletion of old recordsbut not modification of existing records on the other handa word processor implements all the features mentioned what you implement and how you implement it depends solely on the kind of application you create separating the user interface from the activities that go on behind the user interface is important to keep things simplethis example focuses on what needs to go on behind the user interface to make updates to the file you created in the "creating filesectionearlier in this the following steps demonstrate how to readmodifyand write file in order to update it the updates consist of an additiona deletionand change to allow you to run the application more than oncethe updates are actually sent to another file this example also appears with the downloadable source code as formatteddata py and updatecsv py open python file window you see an editor in which you can type the example code type the following code into the window -pressing enter after each linefrom formatteddata import formatdata import os path
9,716
if not os path isfile("testfile csv")print("please run the createfile py example!"quit(newdata formatdata readdata("testfile csv"for entry in newdataprint(entryprint("\ \nadding record for harry "newrecord "'harry' falsenewdata append(newrecordfor entry in newdataprint(entryprint("\ \nremoving doug' record "location newdata index("'doug' true"record newdata[locationnewdata remove(recordfor entry in newdataprint(entryprint("\ \nmodifying sally' record "location newdata index("'sally' false"record newdata[locationsplit record split(","newrecord formatdata(split[ replace("'""")int(split[ ])bool(split[ ])newrecord married true newrecord age newdata append(newrecord __str__()newdata remove(recordfor entry in newdataprint(entryformatdata savedata("changedfile csv"newdatathis example has quite bit going on firstit checks to ensure that the testfile csv file is actually present for processing this is check that you should always perform when you expect file to be present in this caseyou aren' creating new fileyou're updating an existing fileso the file must be present if the file isn' presentthe application ends the next step is to read the data into newdata this part of the process looks much like the data reading example earlier in the you have already seen code for using list functions in this example uses those functions to perform practical work the append(function adds new record to newdata howevernotice that the data is added as stringnot as formatdata object the data is stored as
9,717
strings on diskso that' what you get when the data is read back in you can either add the new data as string or create formatdata object and then use the __str__(method to output the data as string the next step is to remove record from newdata to perform this taskyou must first find the record of coursethat' easy when working with just four records (remember that newdata now has record for harry in itwhen working with large number of recordsyou must first search for the record using the index(function this act provides you with number containing the location of the recordwhich you can then use to retrieve the actual record after you have the actual recordyou can remove it using the remove(function modifying sally' record looks daunting at firstbut againmost of this code is part of dealing with the string storage on disk when you obtain the record from newdatawhat you receive is single string with all three values in it the split(function produces list containing the three entries as stringswhich still won' work for the application in additionsally' name is enclosed in both double and single quotes the simplest way to manage the record is to create formatdata object and to convert each of the strings into the proper form this means removing the extra quotes from the nameconverting the second value to an intand converting the third value to bool the formatdata class doesn' provide accessorsso the application modifies both the married and age fields directly using accessors (getter methods that provide read-only access and setter methods that provide write-only accessis better policy the application then appends the new record to and removes the existing record from newdata notice how the code uses newrecord __str__(to convert the new record from formatdata object to the required string the final act is to save the changed record normallyyou' use the same file to save the data howeverthe example saves the data to different file in order to allow examination of both the old and new data choose runrun module you see the output shown in figure - notice that the application lists the records after each change so that you can see the status of newdata this is actually useful troubleshooting technique for your own applications of courseyou want to remove the display code before you release the application to production open the changedfile csv file using an appropriate application you see output similar to that shown in figure - this output is shown using wordpadbut the data won' change when you use other applications soeven if your screen doesn' quite match figure - you should still see the same data
9,718
figure - the applica tion shows each of the modifica tions in turn figure - the updated information appears as expected in changed file csv
9,719
deleting file the previous section of this "updating file content,explains how to adddeleteand update records in file howeverat some point you may need to delete the file the following steps describe how to delete files that you no longer need this example also appears with the downloadable source code as deletecsv py open python file window you see an editor in which you can type the example code type the following code into the window -pressing enter after each lineimport os os remove("changedfile csv"print("file removed!"the task looks simple in this caseand it is all you need to do to remove file is call os remove(with the appropriate filename and path (as neededpython defaults to the current directoryso you don' need to specify path if the file you want to remove is in the default directorythe ease with which you can perform this task is almost scary because it' too easy putting safeguards in place is always good idea you may want to remove other itemsso here are other functions you should know aboutos rmdir()removes the specified directory the directory must be empty or python will display an exception message shutil rmtree()removes the specified directoryall subdirectoriesand all files this function is especially dangerous because it removes everything without checking (python assumes that you know what you're doingas resultyou can easily lose data using this function choose runrun module the application displays the file removedmessage when you look in the directory that originally contained the changedfile csv fileyou see that the file is gone
9,720
sending an -mail in this defining the series of events for sending an -mail developing an -mail application testing the -mail application his helps you understand the process of sending an -mail using python more importantthis is generally about helping you understand what happens when you communicate outside the local pc even though this is specifically about -mailit also contains principles you can use when performing other tasks for examplewhen working with an external serviceyou often need to create the same sort of packaging as you do for an -mail sothe information you see in this can help you understand all sorts of communication needs to make working with -mail as easy as possiblethis uses standard mail as real-world equivalent of -mail the comparison is apt -mail was actually modeled on real-world mail originallythe term -mail was used for any sort of electronic document transmissionand some forms of it required the sender and recipient to be online at the same time as resultyou may find some confusing references online about the origins and development of -mail this views -mail as it exists today -as storing and forwarding mechanism for exchanging documents of various types the examples in this rely on the availability of simple mail transfer protocol (smtpserver if that sounds like greek to youread the sidebar entitled "considering the smtp serverthat appears later in the
9,721
considering the simple mail transfer protocol when you work with -mailyou see lot of references to simple mail transfer protocol (smtpof coursethe term looks really techni caland what happens under the covers truly is technicalbut all you really need to know is that it works on the other handunderstanding smtp little more than as "black boxthat takes an -mail from the sender and spits it out at the other end to the recipient can be useful taking the term apart (in reverse order)you see these elementsprotocola standard set of rules -mail work by requiring rules that everyone agrees upon otherwisee-mail would become unreliable mail transferdocuments are sent from one place to anothermuch the same as what the post office does with real mail in -mail' casethe transfer process relies on short commands that your -mail applica tion issues to the smtp server for examplethe mail from command tells the smtp server who is sending the -mailwhile the rcpt to command states where to send it simplestates that this activity goes on with the least amount of effort possible the fewer parts to anythingthe more reliable it becomes if you were to look at the rules for transferring the informationyou would find they're anything but simple for examplerfc is standard that specifies how internet hosts are supposed to work (see rfcs/rfc html for detailsthese rules are used by more than one internet technologywhich explains why most of them appear to work about the same (even though their resources and goals may be differentanotherentirely different standardrfc describes how smtp specifically implements the rules found in rfc (see www faqs org/rfcs/rfc html for detailsthe point isa whole lot of rules are written in jargon that only true geek could love (and even the geeks aren' sureif you want plain-english explanation of how -mail workscheck out the article at com/ -mail-messaging/email htm page of this article (howstuffworks com/ -mailmessaging/email htmdescribes the commands that smtp uses to send informa tion hither and thither across the internet in factif you want the shortest possible descrip tion of smtppage is probably the right place to look understanding what happens when you send -mail -mail has become so reliable and so mundane that most people don' understand what miracle it is that it works at all actuallythe same can be said of the real mail service when you think about itthe likelihood of one particular
9,722
letter leaving one location and ending up precisely where it should at the other end seems impossible -mind-bogglingeven howeverboth -mail and its real-world equivalent have several aspects in common that improve the likelihood that they'll actually work as intended the following sections examine what happens when you write an -mailclick sendand the recipient receives it on the other end you might be surprised at what you discover viewing -mail as you do letter the best way to view -mail is the same as how you view letter when you write letteryou provide two pieces of paper as minimum the first contains the content of the letterthe second is an envelope assuming that the postal service is honestthe content is never examined by anyone other than the recipient the same can be said of -mail an -mail actually consists of these componentsmessagethe content of the -mailwhich is actually composed of two subpartsheaderthe part of the -mail content that includes the subjectthe list of recipientsand other featuressuch as the urgency of the -mail bodythe part of the -mail content that contains the actual message the message can be in plain textformatted as htmland consisting of one or more documentsor it can be combination of all these elements envelopea container for the message the envelope provides sender and recipient informationjust as the envelope for physical piece of mail provides howeveran -mail doesn' include stamp when working with -mailyou create message using an -mail application as part of the -mail application setupyou also define account information when you click send the -mail application wraps up your messagewith the header firstin an envelope that includes both your sender and the recipient' information the -mail application uses the account information to contact the smtp server and send the message for you the smtp server reads only the information found in the message envelope and redirects your -mail to the recipient the recipient -mail application logs on to the local serverpicks up the -mailand then displays only the message part for the user
9,723
the process is little more complex than this explanationbut this is essentially what happens in factit' much the same as the process used when working with physical letters in that the essential steps are the same with physical mailthe -mail application is replaced by you on one end and the recipient at the other the smtp server is replaced by the post office and the employees who work there (including the postal carriershoweversomeone generates messagethe message is transferred to recipientand the recipient receives the message in both cases defining the parts of the envelope there is difference in how the envelope for an -mail is configured and how it' actually handled when you view the envelope for an -mailit looks just like letter in that it contains the address of the sender and the address of the recipient it may not look physically like an envelopebut the same components are there when you visualize physical envelopeyou see certain specificssuch as the sender' namestreet addresscitystateand zip code the same is true for the recipient these elements definein physical termswhere the postal carrier should deliver the letter or return the letter when it can' be delivered howeverwhen the smtp server processes the envelope for an -mailit must look at the specifics of the addresswhich is where the analogy of physical envelope used for mail starts to break down little an -mail address contains different information from physical address in summaryhere is what the -mail address containshostthe host is akin to the city and state used by physical mail envelope host address is the address used by the card that is physically connected to the internetand it handles all the traffic that the internet consumes or provides for this particular machine pc can use internet resources in lot of waysbut the host address for all these uses is the same portthe port is akin to the street address used by physical mail envelope it specifies which specific part of the system should receive the message for examplean smtp server used for outgoing messages normally relies on port howeverthe point-of-presence (pop server used for incoming -mail messages usually relies on port your browser typically uses port to communicate with websites howeversecure websites (those that use https as protocolrather than httprely on port instead you can see list of typical ports at en wikipedia org/wiki/list_of_tcp_and_udp_port_numbers
9,724
local hostnamethe local hostname is the human-readable form of the combination of the host and port for examplethe website www myplace com might resolve to an address of : (where the first four numbers are the host address and the number after the colon is the portpython takes care of these details behind the scenes for youso normally you don' need to worry about them howeverit' nice to know that this information is available now that you have better idea of how the address is put togetherit' time to look at it more carefully the following sections describe the envelope of an -mail in more precise terms host host address is the identifier for connection to server just as an address on an envelope isn' the actual locationneither is the host address the actual server it merely specifies the location of the server the connection used to access combination of host address and port is called socket just who came up with this odd name and why isn' important what is important is that you can use the socket to find out all kinds of information that' useful in understanding how -mail works the following steps help you see hostnames and host addresses at work more importantyou begin to understand the whole idea of an -mail envelope and the addresses it contains open python shell window you see the familiar python prompt type import socket and press enter before you can work with socketsyou must import the socket library this library contains all sorts of confusing attributesso use it with caution howeverthis library also contains some interesting functions that help you see how the internet addresses work type socket gethostbyname("localhost"and press enter you see host address as output in this caseyou should see as output because localhost is standard hostname the address is associated with the host namelocalhost type socket gethostbyaddr( "and press enter be prepared for surprise you get tuple as outputas shown in figure - howeverinstead of getting localhost as the name of the hostyou get the name of your machine you use localhost as common name for the local machinebut when you specify the addressyou get the machine name instead in this casemain is the name of my personal machine the name you see on your screen will correspond to your machine
9,725
figure - the local host address actually cor responds to your machine type socket gethostbyname("www johnmuellerbooks com"and press enter you see the output shown in figure - this is the address for my website the point is that these addresses work wherever you are and whatever you're doing -just like those you place on physical envelope the physical mail uses addresses that are unique across the worldjust as the internet does figure - the addresses that you use to send -mail are unique across the internet close the python shell port port is specific entryway for server location the host address specifies the locationbut the port defines where to get in even if you don' specify port every time you use host addressthe port is implied access is always
9,726
granted using combination of the host address and the port the following steps help illustrate how ports work with the host address to provide server access open python shell window you see the familiar python prompt type import socket and press enter remember that socket provides both host address and port information you use the socket to create connection that includes both items type socket getaddrinfo("localhost" and press enter the first value is the name of host you want to obtain information about the second value is the port on that host in this caseyou obtain the information about localhost port you see the output shown in figure - the output consists of two tuplesone for the internet protocol version (ipv output and one for the internet protocol version (ipv address each of these tuples contains five entriesfour of which you really don' need to worry about because you'll likely never need them howeverthe last entry( ' )shows the address and port for localhost port figure - the local host host provides both an ipv and an ipv address type socket getaddrinfo("johnmuellerbooks com" and press enter figure - shows the output from this command notice that this internet location provides only an ipv addressnot an ipv addressfor port the socket getaddrinfo(method provides useful method for determining how you can access particular location using ipv provides significant benefits over ipv (see networkcomputing com/networking/six-benefits-of-ipv / -id/ for details)but most internet locations provide only ipv support now
9,727
figure - most internet locations provide only an ipv address type socket getservbyport( and press enter you see the output shown in figure - the socket getservbyport(method provides the means to determine how particular port is used port is always dedicated to smtp support on any server sowhen you access : you're asking for the smtp server on localhost in shorta port provides specific kind of access in many situations figure - standardized ports provide specific services on every server close the python shell some people assume that the port information is always provided howeverthis isn' always the case python will provide default port when you don' supply onebut relying on the default port is bad idea because you can' be certain which service will be accessed in additionsome systems use nonstandard port assignments as security feature always get into the habit of using the port number and ensuring that you have the right one for the task at hand
9,728
local hostname hostname is simply the human-readable form of the host address humans don' really understand very well (and the ipv addresses make even less sensehoweverhumans do understand localhost just fine there is special server and setup to translate human-readable hostnames to host addressesbut you really don' need to worry about it for this book (or programming in generalwhen your application suddenly breaks for no apparent reasonit helps to know that one does existthough the "hostsectionearlier in this introduces you to the hostname to certain extent through the use of the socket gethostbyaddr(methodwhereby an address is translated into hostname you saw the process in reverse using the socket gethostbyname(method the following steps help you understand some nuances about working with the hostname open python shell window you see the familiar python prompt type import socket and press enter type socket gethostnameand press enter you see the name of the local systemas shown in figure - the name of your system will likely vary from mineso your output will be different than that shown in figure - but the idea is the same no matter which system you use figure - sometimes you need to know the name of the local system type socket gethostbyname(socket gethostname)and press enter you see the ip address of the local systemas shown in figure - againyour setup is likely different from mineso the output you see will differ this is method you can use in your applications to determine the address of the sender when needed because it doesn' rely on any hard-coded valuethe method works on any system close the python shell
9,729
figure - avoid using hard-coded values for the local system whenever possible defining the parts of the letter the "envelopefor an -mail address is what the smtp server uses to route the -mail howeverthe envelope doesn' include any content -that' the purpose of the letter lot of developers get the two elements confused because the letter contains sender and receiver information as well this information appears in the letter just like the address information that appears in business letter -it' for the benefit of the viewer when you send business letterthe postal delivery person doesn' open the envelope to see the address information inside only the information on the envelope matters it' because the information in the -mail letter is separate from its information in the envelope that nefarious individuals can spoof -mail addresses the envelope potentially contains legitimate sender informationbut the letter may not (when you see the -mail in your -mail applicationall that is present is the letternot the envelope -the envelope has been stripped away by the -mail application for that matterneither the sender nor the recipient information may be correct in the letter that you see onscreen in your -mail reader the letter part of an -mail is actually made of separate componentsjust as the envelope is here is summary of the three componentssenderthe sender information tells you who sent the message it contains just the -mail address of the sender receiverthe receiver information tells you who will receive the message this is actually list of recipient -mail addresses even if you want to send the message to only one personyou must supply the single -mail address in list
9,730
messagecontains the information that you want the recipient to see this information can include the followingfromthe human-readable form of the sender tothe human-readable form of the recipients ccvisible recipients who also received the messageeven though they aren' the primary targets of the message subjectthe purpose of the message documentsone or more documentsincluding the text message that appears with the -mail -mails can actually become quite complex and lengthy depending on the kind of -mail that is senta message could include all sorts of additional information howevermost -mails contain these simple componentsand this is all the information you need to send an -mail from your application the following sections describe the process used to generate letter and its components in more detail defining the message sending an empty envelope to someone will workbut it isn' very exciting in order to make your -mail message worthwhileyou need to define message python supports number of methods of creating messages howeverthe easiest and most reliable way to create message is to use the multipurpose internet mail extensions (mimefunctionality that python provides (and noa mime is not silent person with white gloves who acts out in publicas with many -mail featuresmime is standardizedso it works the same no matter which platform you use there are also numerous forms of mime that are all part of the email mime module described at python org/ /library/email mime html here are the forms that you need to consider most often when working with -mailmimeapplicationprovides method for sending and receiving application input and output mimeaudiocontains an audio file mimeimagecontains an image file mimemultipartallows single message to contain multiple subpartssuch as including both text and graphics in single message mimetextcontains text data that can be in asciihtmlor another standardized format
9,731
although you can create any sort of an -mail message with pythonthe easiest type to create is one that contains plain text the lack of formatting in the content lets you focus on the technique used to create the messagerather than on the message content the following steps help you understand how the message-creating process worksbut you won' actually send the message anywhere open python shell window you see the familiar python prompt type the following code (pressing enter after each line)from email mime text import mimetext msg mimetext("hello there"msg['subject'" test messagemsg['from']='john mueller msg['to''john mueller this is basic plain-text message before you can do anythingyou must import the required classwhich is mimetext if you were creating some other sort of messageyou' need to import other classes or import the email mime module as whole the mimetext(constructor requires message text as input this is the body of your messageso it might be quite long in this casethe message is relatively short -just greeting at this pointyou assign values to standard attributes the example shows the three common attributes that you always definesubjectfromand to the two address fieldsfrom and tocontain both human-readable name and the -mail address all you have to include is the -mail address type msg as_stringand press enter you see the output shown in figure - this is how the message actually looks if you have ever looked under the covers at the messages produced by your -mail applicationthe text probably looks familiar the content-type reflects the kind of message you createdwhich is plain-text message the charset tells what kind of characters are used in the message so that the recipient knows how to handle them the mime-version specifies the version of mime used to create the message so that the recipient knows whether it can handle the content finallythe context-transfer-encoding determines how the message is converted into bit stream before it is sent to the recipient
9,732
figure - python adds some additional information required to make your message work specifying the transmission an earlier section ("defining the parts of the envelope"describes how the envelope is used to transfer the message from one location to another the process of sending the message entails defining transmission method python actually creates the envelope for you and performs the transmissionbut you must still define the particulars of the transmission the following steps help you understand the simplest approach to transmitting message using python these steps won' result in successful transmission unless you modify them to match your setup read the "considering the smtp serversidebar for additional information use the python shell window that you opened if you followed the steps in the "defining the messagesection you should see the message that you created earlier type the following code (pressing enter after each line and pressing enter twice after the last line)import smtplib smtplib smtp('localhost'the smtplib module contains everything needed to create the message envelope and send it the first step in this process is to create connection to the smtp serverwhich you name as string in the constructor if the smtp server that you provide doesn' existthe application will fail at this pointsaying that the host actively refused the connection
9,733
type sendmail('senderaddress'['recipientaddress']msg as_string)and press enter in order for this step to workyou must replace senderaddress and recipientaddress with real addresses don' include the humanreadable form this time -the server requires only an address this is the step that actually creates the envelopepackages the -mail messageand sends it off to the recipient notice that you specify the sender and recipient information separately from the messagewhich the smtp server doesn' read close the python shell considering the message subtypes the "defining the messagesectionearlier in this describes the major -mail message typessuch as application and text howeverif -mail had to rely on just those typestransmitting coherent messages to anyone would be difficult the problem is that the type of information isn' explicit enough if you send someone text messageyou need to know what sort of text it is before you can process itand guessing just isn' good idea text message could be formatted as plain textor it might actually be an html page you wouldn' know from just seeing the typeso messages require subtype the type is text and the subtype is html when you send an html page to someone the type and subtype are separated by forward slashso you' see text/html if you looked at the message theoreticallythe number of subtypes is unlimited as long as the platform has handler defined for that subtype howeverthe reality is that everyone needs to agree on the subtypes or there won' be handler (unless you're talking about custom application for which the two parties have agreed to custom subtype in advancewith this in mindyou can find listing of standard types and subtypes at html the nice thing about the table on this site is that it provides you with common file extension associated with the subtype and reference to obtain additional information about it creating the -mail message so faryou've seen how both the envelope and the message work now it' time to put them together and see how they actually work the following sections show how to create two messages the first message is plain-text message and the second message uses html formatting both messages should work fine with most -mail readers -nothing fancy is involved
9,734
working with text message text messages represent the most efficient and least resource-intensive method of sending communication howevertext messages also convey the least amount of information yesyou can use emoticons to help get the point acrossbut the lack of formatting can become problem in some situations the following steps describe how to create simple text message using python this example also appears with the downloadable source code as textmessage py open python file window you see an editor in which you can type the example code type the following code into the window -pressing enter after each linefrom email mime text import mimetext import smtplib msg mimetext("hello there!"msg['subject'' test messagemsg['from']='senderaddressmsg['to''recipientaddresss smtplib smtp('localhost' sendmail('senderaddress'['recipientaddress']msg as_string()print("message sent!"this example is combination of everything you've seen so far in the howeverthis is the first time you've seen everything put together notice that you create the message firstand then the envelope (just as you would in real life choose runrun module the application tells you that it has sent the message to the recipient
9,735
considering the smtp server if you tried the example in this with out modifying ityou're probably scratching your head right now trying to figure out what went wrong it' unlikely that your system has an smtp server connected to localhost the reason for the examples to use localhost is to provide placeholder that you replace later with the information for your particular setup in order to see the example actually workyou need an smtp server as well as real-world -mail account of courseyou could install all the software required to create such an environment on your own systemand some developers who work extensively with -mail applications do just that most platforms come with an -mail package that you can installor you can use freely available substitute such as sendmailan open source product available for download at sendmail com/sm/open_sourcedownloadthe easiest way to see the example work is to use the same smtp server that your -mail application uses when you set up your -mail applicationyou either asked the -mail application to detect the smtp server or you supplied the smtp server on your own the configuration settings for your -mail application should contain the required information the exact location of this infor mation varies widely by -mail applicationso you need to look at the documentation for your particular product no matter what sort of smtp server you even tually findyou need to have an account on that server in most cases to use the functionality it provides replace the information in the exam ples with the information for your smtp serversuch as smtp myisp comalong with your -mail address for both sender and receiver otherwisethe example won' work working with an html message an html message is basically text message with special formatting the following steps help you create an html -mail to send off this example also appears with the downloadable source code as htmlmessage py open python file window you see an editor in which you can type the example code type the following code into the window -pressing enter after each linefrom email mime text import mimetext import smtplib msg mimetext" headinghello there!","html"
9,736
msg['subject'' test html messagemsg['from']='senderaddressmsg['to''recipientaddresss smtplib smtp('localhost' sendmail('senderaddress'['recipientaddress']msg as_string()print("message sent!"the example follows the same flow as the text message example in the previous section howevernotice that the message now contains html tags you create an html bodynot an entire page this message will have an header and paragraph the most important part of this example is the text that comes after the message the "htmlargument changes the subtype from text/plain to text/htmlso the recipient knows to treat the message as html content if you don' make this changethe recipient won' see the html output choose runrun module the application tells you that it has sent the message to the recipient seeing the -mail output at this pointyou have between one and three application-generated messages (depending on how you've gone through the waiting in your inbox to see the messages you created in earlier sectionsyour -mail application must receive the messages from the server -just as it would with any -mail figure - shows an example of the html version of the message when viewed in output (your message will likely look different depending on your platform and -mail application if your -mail application offers the capability to look at the message sourceyou find that the message actually does contain the information you saw earlier in the nothing is changed or different about it because after it leaves the applicationthe message isn' changed in any way during its trip
9,737
figure - the html output contains header and paragraph as expected the point of creating your own application to send and receive -mail isn' convenience -using an off-the-shelf application serves that purpose much better the point is flexibility as you can see from this short on the subjectyou control every aspect of the message when you create your own application python hides much of the detail from viewso what you really need to worry about are the essentials of creating and transmitting the message using the correct arguments
9,738
the part of tens enjoy an additional part of tens article about ten sites with unique designs at www dummies com/extras/beginningprogrammingwithpython
9,739
discover really cool resources that you can use to make your python programming experience better earn living with the python knowledge you gain get the tools you need to work more efficiently with python make python do even more by adding libraries
9,740
ten amazing programming resources in this using the python documentation accessing an interactive python tutorial creating online applications using python extending python using third-party libraries obtaining better editor than python' for python application development getting the syntax for your python application correct working with xml becoming professional coder with less effort than usual overcoming the unicode obstacle creating applications that run fast his book is great start to your python programming experiencebut you'll want additional resources at some point this provides you with ten amazing programming resources that you can use to make your development experience better by using these resourcesyou save both time and energy in creating your next dazzling python application of coursethis is only the beginning of your python resource experience literally reams of python documentation are out therealong with mountains of python code it might be possible to write an entire book (or twoon just the python libraries this is designed to provide you with ideas of where to look for additional information that' targeted toward meeting your specific needs don' let this be the end of your search -consider this the start of your search instead
9,741
working with the python documentation online an essential part of working with python is knowing what is available in the base language and how to extend it to perform other tasks the python documentation at version of the product at the time of this writingit may be updated by the time you read this contains lot more than just the reference to the language that you receive as part of download in factyou see these topics discussed as part of the documentationnew features in the current version of the language access to full-fledged tutorial complete library reference complete language reference how to install and configure python how to perform specific tasks in python help with installing python modules from other sources (as means of extending pythonhelp with distributing python modules you create so that others can use them how to extend python using / +and then embed the new features you create complete reference for / +developers who want to extend their applications using python frequently asked questions (faqpages all this information is provided in form that is easy to access and use in addition to the usual table-of-contents approach to finding informationyou have access to number of indexes for exampleif you aren' interested in anything but locating particular moduleclassor methodyou can use the global module index the report problems with python it' important to work through problems you're having with the productbut as with any other languagepython does have bugs in it locating and destroying the bugs will only make python better language
9,742
using the learnpython org tutorial many tutorials are available for python and many of them do great jobbut they're all lacking special feature that you find when using the learnpython org tutorial at just reading about python featureyou read it and then try it yourself using the interactive feature of the site you have already worked through all the material in the simple tutorials in this book howeveryou haven' worked through the advanced tutorials yet these tutorials present the following topicsgeneratorsspecialized functions that return iterators list comprehensionsa method to generate new lists based on existing lists multiple function argumentsan extension of the methods described in the "using methods with variable argument listsin regular expressionswildcard setups used to match patterns of characterssuch as telephone numbers exception handlingan extension of the methods described in setsdemonstrates special kind of list that never contains duplicate entries serializationshows how to use data storage methodology called javascript object notation (jsonpartial functionsa technique for creating specialized versions of simple functions that derive from more complex functions for exampleif you have multiply(function that requires two argumentsa partial function named double(might require only one argument that it always multiplies by code introspectionprovides the ability to examine classesfunctionsand keywords to determine their purpose and capabilities decoratora method for making simple modifications to callable objects
9,743
performing web programming using python this book discusses the ins and outs of basic programmingso it relies on desktop applications because of their simplicity howevermany developers specialize in creating online applications of various sorts using python the web programming in python site at webprogramming helps you make the move from the desktop to online application development it doesn' just cover one sort of online application -it covers almost all of them (an entire book free for the askingthe tutorials are divided into these three major (and many minorareasserver developing server-side frameworks for applications creating common gateway interface (cgiscript providing server applications developing content management systems (cmsdesigning data access methods through web services solutions client interacting with browsers and browser-based technologies creating browser-based clients accessing data through various methodologiesincluding web services related creating common solutions for python-based online computing interacting with database management systems (dbmssdesigning application templates building intranet solutions getting additional libraries the pythonware site (that interesting until you start clicking the links it provides you with access to number of third-party libraries that help you perform additional tasks
9,744
using python although all the links provide you with useful resourcesthe "downloads (downloads effbot org)link is the one you should look at first this download site provides you with access to aggdrawa library that helps you create anti-aliased drawings celementtreean add-on to the elementtree library that makes working with xml data more efficient and faster consolean interface for windows that makes it possible to create better console applications effbota collection of useful add-ons and utilitiesincluding the effnews rss news reader elementsoapa library that helps you create simple object access protocol (soapconnections to web services providers elementtidyan add-on to the elementtree library that helps you create nicer-looking and more functional xml tree displays than the standard ones in python elementtreea library that helps you interact with xml data more efficiently than standard python allows exemakera utility that creates an executable program from your python script so that you can execute the script just as you would any other application on your machine ftpparsea library for working with ftp sites grabscreena library for performing screen captures imagingprovides the source distribution to the python imaging library (pilthat lets you add image-processing capabilities to the python interpreter having the source lets you customize pil to meet specific needs pilbinary installers for pilwhich make obtaining good installation for your system easier (there are other pil-based libraries as wellsuch as pilfont - library for adding enhanced font functionality to pilbased application pythondoca utility for creating documentation from the comments in your python code that works much like javadoc squeezea utility for converting your python application contained in multiple files into oneor two-file distribution that will execute as normal with the python interpreter tkinter widget-building library for python that includes number of subproducts widgets are essentially bits of code that create controlssuch as buttonsto use in gui applications there are number of addons for the tkinter librarysuch as wckgraphwhich helps you add graphing support to an application
9,745
creating applications faster using an ide an interactive development environment (idehelps you create applications in specific language the integrated development environment (idleeditor that comes with python worked well for the needs of the bookbut you may find it limited after while for exampleidle doesn' provide the advanced debugging functionality that many developers favor in additionyou may find that you want to create graphical applicationswhich is difficult using idle you can talk to developers and get little consensus as to the best tool for any jobespecially when discussing ides every developer has favorite product and isn' easily swayed to try another developers invest many hours learning particular ide and extending it to meet specific requirements (when the ide allows such tamperingan inability (at timesto change ides later is why it' important to try number of different ides before you settle on one (the most common reason for not wanting to change an ide after you select one is that the project types are incompatiblewhich would mean having to re-create your projects every time you change editorsbut there are many other reasons that you can find listed online the pythoneditors wiki at moin/pythoneditors provides an extensive list of ides that you can try the table provides you with particulars about each editor so that you can eliminate some of the choices immediately checking your syntax with greater ease the idle editor provides some level of syntax highlightingwhich is helpful in finding errors for exampleif you mistype keywordit doesn' change color to the color used for keywords on your system seeing that it hasn' changed makes it possible for you to know to correct the error immediatelyinstead of having to run the application and find out later that something has gone wrong (sometimes after hours of debugging
9,746
the python vim utility (php?script_id= provides enhanced syntax highlighting that makes finding errors in your python script even easier this utility runs as scriptwhich makes it fast and efficient to use on any platform in additionyou can tweak the source code as needed to meet particular needs using xml to your advantage the extensible markup language (xmlis used for data storage of all types in most applications of any substance today you probably have number of xml files on your system and don' even know it because xml data appears under number of file extensions for examplemany config filesused to hold application settingsrely on xml in shortit' not matter of if you'll encounter xml when writing python applicationsbut when xml has number of advantages over other means of storing data for exampleit' platform independent you can use xml on any systemand the same file is readable on any other system as long as that system knows the file format the platform independence of xml is why it appears with so many other technologiessuch as web services in additionxml is relatively easy to learn and because it' textyou can usually fix problems with it without too many problems it' important to learn about xml itselfand you can do so using an easy tutorial such as the one found on the schools site at schools com/xml/default asp some developers rush ahead and later find that they can' understand the python-specific materials that assume they already know how to write basic xml files the schools site is nice because it breaks up the learning process into so that you can work with xml little at timeas followstaking basic xml tutorial validating your xml files using xml with javascript (which may not seem importantbut javascript is prominent in many online application scenariosgaining an overview of xml-related technologies using advanced xml techniques working with xml examples that make seeing xml in action easier
9,747
using schools to your advantage one of the most used online resources for learning online computing technologies is schools you can find the main page at single resource can help you discover every web technology needed to build any sort of modern application you can imagine the topics includehtml css javascript sql jquery php xml asp net howeveryou should realize that this is just starting point for python developers use the schools material to get good handle on the underlying technologyand then rely on python-specific resources to build your skills most python developers need combination of learning materials to build the skills required to make real difference in application coding after you get the fundamentals downyou need resource that shows how to use xml with python one of the better places to find this information is the python and xml processing site at topicsbetween these two resourcesyou can quickly build knowledge of xml that will have you building python applications that use xml in no time getting past the common python newbie errors absolutely everyone makes coding mistakes -even that snobby fellow down the hall who has been programming for the last years (he started in kindergartenno one likes to make mistakes and some people don' like to own up to thembut everyone does make them so you shouldn' feel too bad when you make mistake simply fix it up and get on with your life of coursethere is difference between making mistake and making an avoidablecommon mistake yeseven the professionals sometimes make the common mistakesbut it' far less likely because they have seen the mistake in the past and have trained themselves to avoid it you can gain an advantage over your competition by avoiding the newbie mistakes that everyone has to learn about sometime to avoid these mistakescheck out this two-part series
9,748
pythoncommon newbie mistakespart (rachum com/blog//python-common-newbiemistakes-part- /pythoncommon newbie mistakespart (rachum com/blog//python-common-newbiemistakes-part- /many other resources are available for people who are just starting with pythonbut these particular resources are succinct and easy to understand you can read them in relatively short timemake some notes about them for later useand avoid those embarrassing errors that everyone tends to remember understanding unicode although this book tries to sidestep the thorny topic of unicodeyou'll eventually encounter it when you start writing serious applications unfortunatelyunicode is one of those topics that had committee deciding what unicode would look likeso we ended up with more than one poorly explained definition of unicode and multitude of standards to define it in shortthere is no one definition for unicode you'll encounter wealth of unicode standards when you start working with more advanced python applicationsespecially when you start working with multiple human languages (each of which seems to favor its own flavor of unicodekeeping in mind the need to discover just what unicode ishere are some resources you should check outthe absolute minimum every software developer absolutelypositively must know about unicode and character sets (no excuses!(www joelonsoftware com/articles/unicode htmlthe updated guide to unicode on python (org//the-updated-guide-to-unicode/python encodings and unicode (com/python-encodings-and-unicode htmlunicode tutorials and overviews (standard/tutorial-info htmlexplain it like ' fivepython and unicode(www reddit com/ /python/comments/ ehexplain_it_like_im_five_python_and_unicode/unicode pain (
9,749
making your python application fast nothing turns off user faster than an application that performs poorly when an application performs poorlyyou can count on users not using it at all in factpoor performance is significant source of application failure in enterprise environments an organization can spend ton of money to build an impressive application that does everythingbut no one uses it because it runs too slowly or has other serious performance problems performance is actually mix of reliabilitysecurityand speed in factyou can read about the performance triangle on my blog at blog johnmuellerbooks com//considering-theperformance-trianglemany developers focus on just the speed part of performance but end up not achieving their goal it' important to look at every aspect of your application' use of resources and to ensure that you use the best coding techniques numerous resources are available to help you understand performance as it applies to python applications howeverone of the best resources out there is " guide to analyzing python performance,at huyng com/posts/python-performance-analysisthe author takes the time to explain why something is performance bottleneckrather than simply tell you that it is after you read this articlemake sure to check out the pythonspeed performance tips at pythonspeed/performancetips as well
9,750
ten ways to make living with py thon in this using python for qa creating your own way in smaller organization employing python for special product-scripting needs working as an administrator demonstrating programming techniques delving into location data mining data of various sorts working with embedded systems processing scientific data analyzing data in real time ou can literally write any application you want using any language you desire given enough timepatienceand effort howeversome undertakings would be so convoluted and time consuming as to make the effort study in frustration in shortmost (possibly allthings are possiblebut not everything is worth the effort using the right tool for the job is always plus in world that views time as something in short supply and not to be squandered
9,751
python excels at certain kinds of taskswhich means that it also lends itself to certain types of programming the kind of programming you can perform determines the job you get and the way in which you make your living for examplepython probably isn' very good choice for writing device driversas / +areso you probably won' find yourself working for hardware company likewisepython can work with databasesbut not at the same depth that comes natively to other languages such as structured query language (sql)so you won' find yourself working on huge corporate database project howeveryou may find yourself using python in academic settings because python does make great learning language (see my blog post on the topic at python-as- -learning-toolthe following sections describe some of the occupations that do use python regularly so that you know what sorts of things you might do with your new-found knowledge of coursea single source can' list every kind of job consider this an overview of some of the more common uses for python working in qa lot of organizations have separate quality assurance (qadepartments that check applications to ensure that they work as advertised many different test script languages are on the marketbut python makes an excellent language in this regard because it' so incredibly flexible in additionyou can use this single language in multiple environments -both on the client and on the server the broad reach of python means that you can learn single language and use it for testing anywhere you need to test somethingand in any environment in this scenariothe developer usually knows another languagesuch as ++and uses python to test the applications written in +howeverthe qa person doesn' need to know another language in all cases in some situationsblind testing may be used to confirm that an application behaves in practical manner or as means for checking the functionality of an external service provider you need to check with the organization you want to work with as to the qualifications required for job from language perspective
9,752
why you need to know multiple programming languages most organizations see knowledge of multiple programming languages as big plus (some see it as requirementof coursewhen you're an employerit' nice to get the best deal you can when hiring new employee knowing broader range of languages means that you can work in more positions and offer greater value to an organization rewriting applica tions in another language is time consumingerror proneand expensiveso most companies look for people who can support an application in the existing languagerather than rebuild it from scratch from your perspectiveknowing more lan guages means that you'll get more interesting jobs and will be less likely to get bored doing the same old thing every day in additionknowing multiple languages tends to reduce frustration most large applications today rely on compo nents written in number of computer lan guages in order to understand the application and how it functions betteryou need to know every language used to construct it knowing multiple languages also makes it possible to learn new languages faster after whileyou start to see patterns in how com puter languages are put togetherso you spend less time with the basics and can move right on to advanced topics the faster you can learn new technologiesthe greater your opportuni ties to work in exciting areas of computer sci ence in shortknowing more languages opens lot of doors becoming the it staff for smaller organization smaller organization may have only one or two it staffwhich means that you have to perform broad range of tasks quickly and efficiently with pythonyou can write utilities and in-house applications quite swiftly even though python might not answer the needs of large organization because it' interpreted (and potentially open to theft or fiddling by unskilled employees)using it in smaller organization makes sense because you have greater access control and need to make changes fast in additionthe ability to use python in significant number of environments reduces the need to use anything but python to meet your needs
9,753
some developers are unaware that python is available in some non-obvious products for exampleeven though you can' use python scripting with internet information server iisright out of the boxyou can add python scripting support to this product using the steps found in the microsoft knowledge base article at if you aren' sure whether particular application can use python for scriptingmake sure that you check it out online performing specialty scripting for applications number of products can use python for scripting purposes for examplemaya (relies on python for scripting purposes by knowing which high-end products support pythonyou can find job working with that application in any business that uses it here are some examples of products that rely on python for scripting needs ds max abaqus blender cinema gimp google app engine houdini inkscape lightwave modo motionbuilder nuke paint shop pro scribus softimage
9,754
this is just the tip of the iceberg you can also use python with the gnu debugger to create more understandable output of complex structuressuch as those found in +containers some video games also rely on python as scripting language in shortyou could build career around creating application scripts using python as the programming language administering network more than few administrators use python to perform tasks such as monitoring network health or creating utilities that automate tasks administrators are often short of timeso anything they can do to automate tasks is plus in factsome network management softwaresuch as trigger (trigger readthedocs org/en/latest/)is actually written in python lot of these tools are open source and free to downloadso you can try them on your network alsosome interesting articles discuss using python for network administrationsuch as "intro to python automation for network engineersat knowing how to use python on your network can ultimately decrease your workload and help you perform your tasks more easily if you want to see some scripts that are written with network management in mindcheck out projects tagged "network managementat tags/network-management teaching programming skills many teachers are looking for fastermore consistent method of teaching computer technology raspberry pi (is single-board computer that makes obtaining the required equipment lot less expensive for schools the smallish device plugs into television or computer monitor to provide full computing capabilities with an incredibly simple setup interestingly enoughpython plays big role into making the raspberry pi into teaching platform for programming skills (piprogramming org/main/?page_id= in realityteachers often use python to extend native raspberry pi capabilities so that it can perform all sorts of interesting tasks (raspberrypi org/tag/python/the project entitledboristhe twitter dino-bot (mindcombining raspberry pi with python is fantastic idea
9,755
helping people decide on location geographic information system (gisprovides means of viewing geographic information with business needs in mind for exampleyou could use gis to determine the best place to put new business or to determine the optimum routes for shipping goods howevergis is used for more than simply deciding on locations -it also provides means for communicating location information better than mapsreportsand other graphicsand method of presenting physical locations to others also interesting is the fact that many gis products use python as their language of choice in facta wealth of python-specific information related to gis is currently availablesuch as the gis and python software laboratory python and gis resources (python-and-gis-resources/gis programming and automation (edu/geog /node/ many gis-specific productssuch as arcgis (software/arcgis)rely on python to automate tasks entire communities develop around these software offeringssuch as python for arcgis (point is that you can use your new programming skills in areas other than computing to earn an income performing data mining everyone is collecting data about everyone and everything else trying to sift through the mountains of data collected is an impossible task without lot of fine-tuned automation the flexible nature of pythoncombined with its terse language that makes changes extremely fastmakes it favorite with people who perform data mining on daily basis in factyou can find an online book on the topica programmer' guide to data miningat guidetodatamining compython makes data mining tasks lot easier the purpose of data mining is to recognize trendswhich means looking for patterns of various sorts the use of artificial intelligence with python makes such pattern recognition possible paper on the topic"data miningdiscovering and visualizing patterns with python(refcardz/data-mining-discovering-and)helps you understand how such analysis is possible you can use python to create just the right tool to locate pattern that could net sales missed by your competitor
9,756
of coursedata mining is used for more than generating sales for examplepeople use data mining to perform tasks such as locating new planets around stars or other types of analysis that increase our knowledge of the universe python figures into this sort of data mining as well you can likely find books and other resources dedicated to any kind of data mining that you want to performwith many of them mentioning python as the language of choice interacting with embedded systems an embedded system exists for nearly every purpose on the planet for exampleif you own programmable thermostat for your houseyou're interacting with an embedded system raspberry pi (mentioned earlier in the is an example of more complex embedded system many embedded systems rely on python as their programming language in facta special form of pythonembedded python (embeddedpython)is sometimes used for these devices you can even find youtube presentation on using python to build an embedded system at interestingly enoughyou might already be interacting with python-driven embedded system for examplepython is the language of choice for many car security systems (start feature that you might have relies on python to get the job done your home automation and security system (article/ might also rely on python python is so popular for embedded systems because it doesn' require compilation an embedded-system vendor can create an update for any embedded system and simply upload the python file the interpreter automatically uses this file without having to upload any new executables or jump through any of the types of hoops that other languages can require carrying out scientific tasks python seems to devote more time to scientific and numerical processing tasks than many of the computer languages out there the number of python' scientific and numeric processing modules is staggering (wiki python org/moin/numericandscientificscientists love python because it' smalleasy to learnand yet quite precise in its treatment of data it' possible to produce results using just few lines code yes
9,757
you could produce the same result using another languagebut the other language might not include the prebuilt modules to perform the taskand it would most definitely require more lines of code even if it did the two sciences that have dedicated python modules are space sciences and life sciences for examplethere is actually module for performing tasks related to solar physics you can also find module for working in genomic biology if you're in scientific fieldthe chances are good that your python knowledge will significantly impact your ability to produce results quickly while your colleagues are still trying to figure out how to analyze the data performing real-time analysis of data making decisions requires timelyreliableand accurate data oftenthis data must come from wide variety of sourceswhich then require certain amount of analysis before becoming useful number of the people who report using python do so in management capacity they use python to probe those disparate sources of informationperform the required analysisand then present the big picture to the manager who has asked for the information given that this task occurs regularlytrying to do it manually every time would be time consuming in factit would simply be waste of time by the time the manager performed the required workthe need to make decision might already have passed python makes it possible to perform tasks quickly enough for decision to have maximum impact previous sections have pointed out python' data-miningnumber-crunchingand graphics capabilities manager can combine all these qualities while using language that isn' nearly as complex to learn as +in additionany changes are easy to makeand the manager doesn' need to worry about learning programming skills such as compiling the application few changes to line of code in an interpreted module usually serve to complete the task as with other sorts of occupational leads in this thinking outside the box is important when getting job lot of people need real-time analysis launching rocket into spacecontrolling product flowensuring that packages get delivered on timeand all sorts of other occupations rely on timelyreliableand accurate data you might be able to create your own new job simply by employing python to perform real-time data analysis
9,758
ten interesting tools in this keeping track of application bugs creating safe place to test applications getting your application placed on user system documenting your application writing your application code looking for application errors working within an interactive environment performing application testing sorting the import statements in your application keeping track of application versions ythonlike most other programming languageshas strong third-party support in the form of various tools tool is any utility that enhances the natural capabilities of python when building an application soa debugger is considered tool because it' utilitybut library isn' libraries are instead used to create better applications (you can see some of them listed in even making the distinction between tool and something that isn' toolsuch as librarydoesn' reduce the list by much python enjoys access to wealth of general-purpose and special tools of all sorts in factthe site at tools down into the following categoriesautomatedrefactoringtools bugtracking configurationandbuildtools distributionutilities documentationtools
9,759
integrateddevelopmentenvironments pythondebuggers pythoneditors pythonshells skeletonbuildertools testsoftware usefulmodules versioncontrol interestingly enoughit' quite possible that the lists on the python developmenttools site aren' even complete you can find python tools listed in quite few places online given that single can' possibly cover all the tools out therethis discusses few of the more interesting tools -those that merit little extra attention on your part after you whet your appetite with this seeing what other sorts of tools you can find online is good idea you may find that the tool you thought you might have to create is already availableand in several different forms tracking bugs with roundup issue tracker you can use number of bug-tracking sites with pythonsuch as the followinggithub (google com/)bitbucket ((as convenient to use as your own specificlocalized bug-tracking software you can use number of tracking systems on your local drivebut roundup issue tracker (offerings roundup should work on any platform that supports pythonand it offers these basic features without any extra workbug tracking todo list management
9,760
if you're willing to put little more work into the installationyou can get additional featuresand these additional features are what make the product special howeverto get themyou may need to install other productssuch as database management system (dbmsthe product instructions tell you what to install and which third-party products are compatible after you make the additional installationsyou get these upgraded featurescustomer help-desk support with the following featureswizard for the phone answerers network links system and development issue trackers issue management for internet engineering task force (ietfworking groups sales lead tracking conference paper submission double-blind referee management blogging (extremely basic right nowbut will become stronger offering latercreating virtual environment using virtualenv reasons abound to create virtual environmentsbut the main reason for to do so with python is to provide safe and known testing environment by using the same testing environment each timeyou help ensure that the application has stable environment until you have completed enough of it to test in production-like environment virtualenv (pypi/virtualenvprovides the means to create virtual python environment that you can use for the early testing process or to diagnose issues that could occur because of the environment it' important to remember that there are at least three standard levels of testing that you need to performbugchecking for errors in your application performancevalidating that your application meets speedreliabilityand security requirements usabilityverifying that your application meets user needs and will react to user input in the way the user expects
9,761
never test on production server mistake that some developers make is to test their unreleased application on the production server where the user can easily get to it of the many reasons not to test your application on production serverdata loss has to be the most important if you allow users to gain access to an unreleased version of your application that contains bugs that might corrupt the database or other data sourcesthe data could be lost or damaged permanently you also need to realize that you get only one chance to make first impression many soft ware projects fail because users don' use the end result the application is completebut no one uses it because of the perception that the application is flawed in some way users have only one goal in mindto complete their tasks and then go home when users see that an application is costing them timethey tend not to use it unreleased applications can also have secu rity holes that nefarious individuals will use to gain access to your network it doesn' matter how well your security software works if you leave the door open for anyone to come in after they have come ingetting rid of them is nearly impossibleand even if you do get rid of themthe damage to your data is already done recovery from security breaches is notoriously difficult -and sometimes impossible in shortnever test on your production server because the costs of doing so are simply too high because of the manner in which most python applications are used (see for some ideas)you generally don' need to run them in virtual environment after the application has gone to production site most python applications require access to the outside worldand the isolation of virtual environment would prevent that access installing your application using pyinstaller users don' want to spend lot of time installing your applicationno matter how much it might help them in the end even if you can get the user to attempt an installationless skilled users are likely to fail in shortyou need surefire method of getting an application from your system to the user' system installerssuch as pyinstaller (do just that they make nice package out of your application that the user can easily install
9,762
avoid the orphaned product some python tools floating around the internet are orphanedwhich means that the devel oper is no longer actively supporting them developers still use the tool because they like the features it supports or how it works howeverdoing so is always risky because you can' be sure that the tool will work with the latest version of python the best way to approach tools is to get tools that are fully sup ported by the vendor who created them if you absolutely must use an orphaned tool (such as when an orphaned tool is the only one available to perform the task)make sure that the tool still has good community support the vendor may not be around any longerbut at least the community will provide source of information when you need product support otherwiseyou'll waste lot of time trying to use an unsupported product that you might never get to work properly fortunatelypyinstaller works on all the platforms that python supportsso you need just the one tool to meet every installation need you have in additionyou can get platform-specific support when needed for examplewhen working on windows platformyou can create code-signed executables mac developers will appreciate that pyinstaller provides support for bundles in many casesavoiding the platform-specific features is best unless you really do need them when you use platform-specific featurethe installation will succeed only on the target platform number of the installer tools that you find online are platform specific for examplewhen you look at an installer that reportedly creates executablesyou need to be careful that the executables aren' platform specific (or at least match the platform you want to useit' important to get product that will work everywhere it' needed so that you don' create an installation package that the user can' use having language that works everywhere doesn' help when the installation package actually hinders installation building developer documentation using pdoc two kinds of documentation are associated with applicationsuser and developer user documentation shows how to use the applicationwhile developer documentation shows how the application works library requires only one sort of documentationdeveloperwhile desktop application may require only user documentation service might actually require
9,763
both kinds of documentation depending on who uses it and how the service is put together the majority of your documentation is likely to affect developersand pdoc (solution for creating it the pdoc utility relies on the documentation that you place in your code in the form of docstrings and comments the output is in the form of text file or an html document you can also have pdoc run in way that provides output through web server so that people can see the documentation directly in browser this is actually replacement for epydocwhich is no longer supported by its originator developing application code using komodo edit several have discussed the issue of interactive development environments (ides)but none have made specific recommendation the ide you choose depends partly on your needs as developeryour skill leveland the kinds of applications you want to create some ides are better than others when it comes to certain kinds of application development one of the better general-purpose ides for novice developers is komodo edit (komodoide com/komodo-edit/you can obtain this ide freeand it includes wealth of features that will make your coding experience much better than what you'll get from idle here are some of those featuressupport for multiple programming languages automatic completion of keywords indentation checking project support so that applications are partially coded before you even begin superior support howeverthe thing that sets komodo edit apart from other ides is that it has an upgrade path when you start to find that your needs are no longer met by komodo edityou can upgrade to komodo ide (which includes lot of professional level support featuressuch as code profiling ( feature that checks application speedand database explorer (to make working with databases easier
9,764
debugging your application using pydbgr high-end idesuch as komodo idecomes with complete debugger even komodo edit comes with simple debugger howeverif you're using something smallerless expensiveand less capable than high-end ideyou might not have debugger at all debugger helps you locate errors in your application and fix them the better your debuggerthe less effort required to locate and fix the error when your editor doesn' include debuggeryou need an external debugger such as pydbgr ( reasonably good debugger includes number of standard featuressuch as code colorization (the use of color to indicate things like keywordshoweverit also includes number of nonstandard features that set it apart here are some of the standard and nonstandard features that make pydbgr good choice when your editor doesn' come with debuggersmart evalthe eval command helps you see what will happen when you execute line of codebefore you actually execute it in the application it helps you perform "what ifanalysis to see what is going wrong with the application out-of-process debuggingnormally you have to debug applications that reside on the same machine in factthe debugger is part of the application' processwhich means that the debugger can actually interfere with the debugging process using out-of-process debugging means that the debugger doesn' affect the application and you don' even have to run the application on the same machine as the debugger thorough byte-code inspectionviewing how the code you write is turned into byte code (the code that the python interpreter actually understandscan sometimes help you solve tough problems event filtering and tracingas your application runs in the debuggerit generates events that help the debugger understand what is going on for examplemoving to the next line of code generates an eventreturning from function call generates another eventand so on this feature makes it possible to control just how the debugger traces through an application and which events it reacts to
9,765
entering an interactive environment using ipython the python shell works fine for many interactive tasks you've used it extensively in this book howeveryou may have already noted that the default shell has certain deficiencies (and if you haven'tyou'll notice them as you work through more advanced examplesof coursethe biggest deficiency is that the python shell is pure text environment in which you must type commands to perform any given task more advanced shellsuch as ipython (by providing gui features so that you don' have to remember the syntax for odd commands ipython is actually more than just simple shell it provides an environment in which you can interact with python in new wayssuch as by displaying graphics that show the result of formulas you create using python in additionipython is designed as kind of front end that can accommodate other languages the ipython application actually sends commands to the real shell in the backgroundso you can use shells from other languages such as julia and haskell (don' worry if you've never heard of these languages one of the more exciting features of ipython is the ability to work in parallel computing environments normally shell is single threadedwhich means that you can' perform any sort of parallel computing in factyou can' even create multithreaded environment this feature alone makes ipython worthy of trial testing python applications using pyunit at some pointyou need to test your applications to ensure that they work as instructed you can test them by entering in one command at time and verifying the resultor you can automate the process obviouslythe automated approach is better because you really do want to get home for dinner someday and manual testing is reallyreally slow (especially when you make mistakeswhich are guaranteed to happenproducts such as pyunit (
9,766
the nice part of this product is that you actually create python code to perform the testing your script is simply anotherspecializedapplication that tests the main application for problems you may be thinking that the scriptsrather than your professionally written applicationcould be bug ridden the testing script is designed to be extremely simplewhich will keep scripting errors small and quite noticeable of courseerrors can (and sometimes dohappenso yeswhen you can' find problem with your applicationyou do need to check the script tidying your code using isort it may seem like an incredibly small thingbut code can get messyespecially if you don' place all your import statements at the top of the file in alphabetical order in some situationsit becomes difficultif not impossibleto figure out what' going on with your code when it isn' kept neat the isort utility (seemingly small task of sorting your import statements and ensuring that they all appear at the top of the source code file this small step can have significant effect on your ability to understand and modify the source code just knowing which modules particular module needs can be help in locating potential problems for exampleif you somehow get an older version of needed module on your systemknowing which modules the application needs can make the process of finding that module easier in additionknowing which modules an application needs is important when it comes time to distribute your application to users knowing that the user has the correct modules available helps ensure that the application will run as anticipated providing version control using mercurial the applications you created while working through this book aren' very complex in factafter you finish this book and move on to more advanced training applicationsyou're unlikely to need version control howeverafter you start working in an organizational development environment in which you create real applications that users need to have available at all timesversion control becomes essential version control is simply the act of keeping
9,767
track of the changes that occur in an application between application releases to the production environment when you say you're using myapp you're referring to version of the myapp application versioning lets everyone know which application release is being used when bug fixes and other kinds of support take place numerous version control products are available for python one of the more interesting offerings is mercurial (com/you can get version of mercurial for almost any platform that python will run onso you don' have to worry about changing products when you change platforms (if your platform doesn' offer binaryexecutablereleaseyou can always build one from the source code provided on the download site unlike lot of the other offerings out theremercurial is free even if you find that you need more advanced product lateryou can gain useful experience by working with mercurial on project or two the act of storing each version of an application in separate place so that changes can be undone or redone as needed is called source code management for many peoplesource code management seems like hard task because the mercurial environment is quite forgivingyou can learn about source control management in friendly environment being able to interact with any version of the source code for particular application is essential when you need to go back and fix problems created by new release the best part about mercurial is that it provides great online tutorial at your own machine is the best way to learn about source control managementbut even just reading the material is helpful of coursethe first tutorial is all about getting good installation of mercurial the tutorials then lead you through the process of creating repository ( place where application versions are storedand using the repository as you create your application code by the time you finish the tutorialsyou should have great idea of how source control should work and why versioning is an important part of application development
9,768
ten libraries you need to know about in this securing your data using cryptology working with databases getting to where you're going and finding new locations presenting the user with gui creating tables that users will enjoy viewing working with graphics finding the information you need allowing access to java code from your python application obtaining access to local network resources using resources found online ython provides you with considerable power when it comes to creating average applications howevermost applications aren' average and require some sort of special processing to make them work that' where libraries come into play good library will extend python functionality so that it supports the special programming needs that you have for exampleyou might need to plot statistics or interact with scientific device these sorts of tasks require the use of library one of the best places to find library listing online is the usefulmodules site at many other places to look for libraries as well for examplethe article entitled " python libraries you should know about(specific platformsuch as windowsyou can find platform-specific sitessuch as unofficial windows binaries for python extension packages (lfd uci edu/~gohlke/pythonlibs/the point is that you can find lists of libraries everywhere
9,769
the purpose of this isn' to add to your already overflowing list of potential library candidates insteadit provides you with list of ten libraries that work on every platform and provide basic services that just about everyone will need think of this as source for core group of libraries to use for your next coding adventure developing secure environment using pycrypto data security is an essential part of any programming effort the reason that applications are so valued is that they make it easy to manipulate and use data of all sorts howeverthe application must protect the data or the efforts to work with it are lost it' the data that is ultimately the valuable part of business -the application is simply tool part of protecting the data is to ensure that no one can steal it or use it in manner that the originator didn' intendwhich is where cryptographic libraries such as pycrypto (www dlitz net/software/pycrypto/come into play the main purpose of this library is to turn your data into something that others can' read while it sits in permanent storage the purposeful modification of data in this manner is called encryption howeverwhen you read the data into memorya decryption routine takes the mangled data and turns it back into its original form so that the application can manage it at the center of all this is the keywhich is used to encrypt and decrypt the data ensuring that the key remains safe is part of your application coding as well you can read the data because you have the keyno others can because they lack the key interacting with databases using sqlalchemy database is essentially an organized manner of storing repetitive or structured data on disk for examplecustomer records (individual entries in the databaseare repetitive because each customer has the same sort of information requirementssuch as nameaddressand telephone number the precise organization of the data determines the sort of database you're using some database products specialize in text organizationothers in tabular informationand still others in random bits of data (such as readings taken from scientific instrumentdatabases can use tree-like structure or flat-file configuration to store data you'll hear all sorts of odd terms when you start looking into database management system (dbmstechnology -most of which mean something only to database administrator (dbaand won' matter to you
9,770
the most common type of database is called relational database management system (rdbms)which uses tables that are organized into records and fields (just like table you might draw on sheet of papereach field is part of column of the same kind of informationsuch as the customer' name tables are related to each other in various waysso creating complex relationships is possible for exampleeach customer may have one or more entries in purchase order tableand the customer table and the purchase order table are therefore related to each other an rdbms relies on special language called the structured query language (sqlto access the individual records inside of courseyou need some means of interacting with both the rdbms and sqlwhich is where sqlalchemy (amount of work needed to ask the database to perform tasks such as returning specific customer recordcreating new customer recordupdating an existing customer recordand deleting an old customer record seeing the world using google maps geocoding (the finding of geographic coordinatessuch as longitude and latitude from geographic datasuch as addresshas lots of uses in the world today people use the information to do everything from finding good restaurant to locating lost hiker in the mountains getting from one place to another often revolves around geocoding today as well google maps (in addition to getting from one point to another or finding lost soul in the desertgoogle maps can also help in geographic information system (gisapplications the "helping people decide on locationsection of describes this particular technology in more detailbut essentiallygis is all about deciding on location for something or determining why one location works better than another location for particular task in shortgoogle maps presents your application with look at the outside world that it can use to help your user make decisions adding graphical user interface using tkinter users respond to the graphical user interface (guibecause it' friendlier and requires less thought than using command-line interface many products out there can give your python application gui howeverthe most
9,771
commonly used product is tkinter (tkinterdevelopers like it so much because tkinter keeps things simple it' actually an interface for the tool command language (tcl)/toolkit (tkfound at basis for creating gui you might not relish the idea of adding gui to your application doing so tends to be time consuming and doesn' make the application any more functional (it also slows the application down in many casesthe point is that users like guisand if you want your application to see strong useyou need to meet user requirements providing nice tabular data presentation using prettytable displaying tabular data in manner the user can understand is important from the examples you've seen throughout the bookyou know that python stores this type of data in form that works best for programming needs howeverusers need something that is organized in manner that humans understand and that is visually appealing the prettytable library (pypi python org/pypi/prettytablemakes it easy to add an appealing tabular presentation to your command-line application enhancing your application with sound using pyaudio sound is useful way to convey certain types of information to the user of courseyou have to be careful in using sound because special-needs users might not be able to hear itand for those who canusing too much sound can interfere with normal business operations howeversometimes audio is an important means of communicating supplementary information to users who can interact with it (or of simply adding bit of pizzazz to make your application more interestingone of the better platform-independent libraries to make sound work with your python application is pyaudio (hubert/pyaudio/this library makes it possible to record and play back sounds as needed (such as user recording an audio note of tasks to perform later and then playing back the list of items as needed
9,772
classifying python sound technologies it' important to realize that sound comes in many forms in computers the basic multime dia services provided by python (see the docu mentation at org/ /library/mm htmlprovide essential playback functionality you can also write certain types of audio filesbut the selec tion of file formats is limited in additionsome modulessuch as winsound (docs python org/ /librarywinsound html)are platform depen dentso you can' use them in an application designed to work everywhere the standard python offerings are designed to provide basic multimedia support for playing back system sounds the middle groundaugmented audio function ality designed to improve application usabilityis covered by libraries such as pyaudio you can see list of these libraries at wiki python org/moin/audio howeverthese libraries usually focus on busi ness needssuch as recording notes and play ing them back later hi-fidelity output isn' part of the plan for these libraries gamers need special audio support to ensure that they can hear special effectssuch as monster walking behind them these needs are addressed by libraries such as pygame (htmlwhen using these librariesyou need higher-end equipment and have to plan to spend considerable time working on just the audio fea tures of your application you can see list of these libraries at org/moin/pythongamelibraries working with sound on computer always involves trade-offs for examplea platform-independent library can' take advantage of special features that particular platform might possess in additionit might not support all the file formats that particular platform uses the reason to use platform-independent library is to ensure that your application provides basic sound support on all systems that it might interact with manipulating images using pyqtgraph humans are visually oriented if you show someone table of information and then show the same information as graphthe graph is always the winner when it comes to conveying information graphs help people see trends and understand why the data has taken the course that it has howevergetting those pixels that represent the tabular information onscreen is difficultwhich is why you need library such as pyqtgraph (www pyqtgraph org/to make things simpler
9,773
even though the library is designed around engineeringmathematicaland scientific requirementsyou have no reason to avoid using it for other purposes pyqtgraph supports both and displaysand you can use it to generate new graphics based on numeric input the output is completely interactiveso user can select image areas for enhancement or other sorts of manipulation in additionthe library comes with wealth of useful widgets (controlssuch as buttonsthat you can display onscreento make the coding process even easier unlike many of the offerings in this pyqtgraph isn' free-standing librarywhich means that you must have other products installed to use it this isn' unexpected because pyqtgraph is doing quite lot of work you need these items installed on your system to use itpython version or above pyqt version or above (or pyside numpy scipy pyopengl (locating your information using irlib finding your information can be difficult when the information grows to certain size consider your hard drive as largefree-formtree-based database that lacks useful index any time such structure becomes large enoughdata simply gets lost (just try to find those pictures you took last summer and you'll get the idea as resulthaving some type of search capability built into your application is important so that users can find that lost file or other information number of search libraries are available for python the problem with most of them is that they are hard to install or don' provide consistent platform support in factsome of them work on only one or two platforms howeverirlib (which ensures that it works on every platform if you find that irlib doesn' meet your needsmake sure the product you do get will provide the required search functionality on all the platforms you select and that the installation requirements are within reason
9,774
irlab works by creating search index of whatever information you want to work with you can then save this index to disk for later use the search mechanism works through the use of metrics -you locate one or more entries that provide best fit for the search criteria creating an interoperable java environment using jpype python does provide access to huge array of librariesand you're really unlikely to use them all howeveryou might be in situation in which you find java library that is perfect fit but can' use it from your python application unless you're willing to jump through whole bunch of hoops the jpype library (access most (but not allof the java libraries out there directly from python the library works by creating bridge between the two languages at the byte-code level consequentlyyou don' have to do anything weird to get your python application to work with java converting your python application to java there are many different ways to achieve interoperability between two languages creating bridge between themas jpype doesis one way another alternative is to convert the code created for one language into code for the other language this is the approach used by jython (this utility converts your python code into java code so that you can make full use of java func tionality in your application while maintaining the features that you like about python you'll encounter trade-offs in lan guage interoperability no matter which solution you use in the case of jpypeyou won' have access to some java libraries in additionthere is speed penalty in using this approach because the jpype bridge is constantly con verting calls and data the problem with jython is that you lose the ability to modify your code after conversion any changes that you make will create an incompatibility between the origi nal python code and its java counterpart in shortno perfect solutions exist for the problem of getting the best features of two languages into one application
9,775
accessing local network resources using twisted matrix depending on your network setupyou may need access to files and other resources that you can' reach using the platform' native capabilities in this caseyou need library that makes such access possiblesuch as twisted matrix (library is to provide you with the calls needed to establish connectionno matter what sort of protocol is in use the feature that makes this library so useful is its event-driven nature this means that your application need not get hung up while waiting for the network to respond in additionthe use of an event-driven setup makes asynchronous communication (in which request is sent by one routine and then handled by completely separate routineeasy to implement accessing internet resources using libraries although products such as twisted matrix can handle online communicationgetting dedicated http protocol library is often better option when working with the internet because dedicated library is both faster and more feature complete when you specifically need http or https supportusing library such as httplib (is good idea this library is written in pure python and makes handling http-specific needssuch as setting keep-alive valuerelatively easy ( keep-alive is value that determines how long port stays open waiting for response so that the application doesn' have to continuously re-create the connectionwasting resources and time as result you can use httplib for any internet-specific methodology -it provides full support for both the get and post request methods this library also includes routines for standard internet compression methodssuch as deflate and gzip it also supports level of automation for examplehttplib adds etags back into put requests when resources are already cached
9,776
operator symbols and numerics <<(less-than or equaloperator (minus sign) !(not equaloperator (number sign) operator %operator operator parentheses (asteriskmultiplication operator variable argument lists *operator **operator *operator (forward slash) /operator /operator //operator (colon) square brackets (backslash) - operator curly brackets operator operator (plus signaddition operator concatenation using operator precedence overloading - as unary operator using indentation with using with tuples +operator (less-thanoperator (assignmentoperator -operator =(equalityoperator (greater-thanoperator >(greater-than or equaloperator >operator (double quotes) (single quote) ds max * \ escape sequence abaqus absolute paths accented characters accessors action warning level add to path option __add__(function additional help sources featureidle aggdraw library aix (advanced ibm unix) alice educational software alignmentstring american standard code for information interchange (ascii) amiga research os (aros) and operator append(function appendleft(function apple siri
9,777
application system (as/ ) applications commands in - commercialwritten in python compile time errors creating in edit window - crud and debugging decision-making and defined designing - installing using pyinstaller - loading in edit window multithreaded overview procedures and purpose of quitting readme files running from command line running from idle - - runtime errors saving files for - usage types - apt-get command - arcgis *args argument list argumentscommand-line argumentsexception listing - overview - argumentsfunction accessing using keywords default values for - overview positional required - variable number of - argumentsmethod - arithmetic operators listing of - precedence arithmeticerror exception aros (amiga research os) as clause as_string(function as/ (application system ) ascii (american standard code for information interchange) asp net assignment operators assigning value to variable listing of precedence asterisk multiplication operator variable argument lists attributesmodule - audio - *bbackslash ) - backspace character base base base base command \ escape sequence - option -bb option - option beos bin(function binary codes binary operators binary to decimal to hexadecimal converter bitbucket bitwise operators - blender blue text in idle bool(function
9,778
boolean type - break statements overview - for while statements bugs defined tracking sites for using virtual environments __builtins__ attribute byte code byte type bytearray type - option *ccjob opportunities and python versus user interfaces __cached__ attribute caller - capitalization capitalize(function car security systems carnegie mellon university carriage return character cascading style sheets (css) case (computer aided software engineering) case sensitivity catching exceptions see exceptionshandling category warning level / ++ celementtree library center(function centos cgi (common gateway interface) characters ascii - creating strings from - escape sequences - selecting individual in string - sets of special - child classes cinema __class__ attribute classes built-in attributes - class suite constructors - creating - creating external - explained - extending - importance of application organization importing module for inheritance method arguments - methods - overloading operators - using external - variables - clear(function client (webapplications cms (content management system) code blocks of - cleaning using isort color coding - commenting out - comments in - common mistakes - grouping into collections - highlighting - indentation - inspecting introspection optimizing readability reusability -
9,779
code (continuedrunnable spaghetti code understandable using edit window - version control - collections - colon ) color coding - comma separated values (csv) command-line python see also idle accessing from command prompt - advantages of arguments close button of terminal commands in enter key in environment variables and - exiting - help mode - idle versus options for - running applications starting viewing result in - comments commenting out code - multiline - single-line uses for common gateway interface (cgi) communication applications and computers and - exceptions and - comparisons function output if statements - overview - precedence compile time errors complex numbers computer aided software engineering (case) computers characters and - communication with - comparisons and crud data storage exceptions - lists and - preciseness of procedures - programming languages purpose of applications strings and concatenation creating lists using defined using operator using with tuples conditions for if statements configuration environment variables - idle - console library constants constructors - content management system (cms) content-type header context-transfer-encoding header continue statements overview - pass clause versus for while statements control characters - control statements if statements - if elif statements - if else statements - nesting - switch statement and
9,780
copy(function copyright(function copyright messages count(function counter object - createreadupdatedelete see crud credits(command - cross-platform support - crud (createreadupdatedeleteapplications and defined file storage - for lists css (cascading style sheets) csv (comma separated values) curly brackets } current directory - option *ddata analysisreal-time data integrity data mining - data storage assigning values creating files - deleting files file storage - purpose of reading files - structure of content - variables writing data to files - data types boolean - complex numbers dates and times - defined determining for variable floating-point values - integers - numeric types strings - database administrator (dba) database management systems (dbmss) databases - datalist argument datareader class datawriter class - dates and times - day value dba (database administrator) dbmss (database management systems) debugging defined starting debugger using pydbgr decryption default values for arguments - del command deleting files delimiters deque type defined sequence types using - development tools dictionaries creating defined overview - sequence types as switch statement - using - dir(function directories division operator ) doc(function __doc__ attribute
9,781
documentation accessing from idle - in comments creating using pdoc - online opening pydoc application - quick-access links - searching - docx files double quotes ) downloading python - drawing characters dynamic systems - option *eedit windowidle - effbot library elementsoap library elementtidy library elementtree library elif clause - else clause for if statements - for loops - try block and for while statements email creating html message - creating text message - envelope analogy - host address - hostname - howstuffworks article letter analogy - - mime types - ports - sending transmission - smtp - subtypes viewing output - email mime module embedded python empty(function encryption endless loops endswith(function engineering applications enter key enumerate(function envelope analogy - environment variables errorlevel environment variable ignoring path environment variable - python configuration - equality =operator errno argument errorlevel environment variable errors see also exceptionsexceptionshandling compile time handling logical - runtime - semantic syntactical types of escape sequences - etags eval command except clause combining specific clauses with generic - defined listing exception arguments multiple clauses - single clause - using - exception exception exceptions see also errors arguments for - built-in
9,782
custom - defined listing arguments - online resources raising - exceptionshandling except clause - finally clause - length checking multiple exceptions - nesting - passing error information to caller - raising exceptions - range checking single exception - specific and unknown exceptions - exec(command exemaker library exit(command - expandtabs(function exponents expressions extend(function extending classes - extendleft(function extensible markup language (xml) - extensionsfile * \ escape sequence features fedora core fermilab fieldsdatabase fifo (first in/first out) file storage creating files - deleting files overview - reading files - structure of content - supported file types writing data to files - __file__ attribute filenotfounderror exception fill character finally clause exceptions and overview - find(function first in/first out (fifo) float(function float type floating-point values formatting strings overview - reasons for multiple numeric types flow control see control statements fluid dynamics flushing data folders fonts/tabs tabidle - for loops break statements - continue statements - creating deque type and else clause - nesting - pass clause - for statement using with lists while statement versus format(function - formfeed character forward slash ) freezing applications from import statements - ftpparse library full(function
9,783
function arguments default values - overview required - using keywords variable number of - functions calling - code reusability and - comparing output from defined defining - overloading partial purpose of returning data from - user input - functions topic *ggcc (gnu compiler collection) general tabidle - generators geocoding geographic information system (gis) get(function getaddrinfo(function __getattribute__(function gethostbyaddr(function gethostbyname(function gethostname(function getserverbyport(function getters/setters gimp gis (geographic information system) github gnu compiler collection (gcc) go com google google app engine google code google maps grabscreen library graphic user interface (gui) - graphs - greater-than operator greater-than or equal >operator green text in idle gui (graphic user interface) - - option *hhandling exceptions see exceptionshandling headersemail help additional help sources feature command for - - displaying help mode - - in idle - for specific commands or topics - hewlett-packard unix (hp-ux) hex(function hexadecimal values hierarchy of tuples - highlighting code - - horizontal tab character host address - hostname - houdini hour value hp-ux (hewlett-packard unix) html (hypertext markup language) - - option
9,784
*iide (integrated development environment) identity operators idle (interactive development environmentsee also commandline python accessing on mac accessing on windows - color coding in - command-line python versus commands in comments in - configuration - edit window - exiting feature overview help in - indentation in - overview python versions and running applications from - - saving files - shortcut keys starting testing installation - ietf (internet engineering task force) if statements code blocks for - if elif statements - if else statements - multiple comparisons for - nesting - overview using relational operators - iis (internet information server) imaging library immutable types import statements ignoring case in importing entire module - importing only needed attributes - overview - using in operator indentation - index for dictionaries for lists for listsnegative for tuples index(function industrial light magic inheritance __init__(constructor function - initializing values __initializing__ attribute inkscape input(function - insert(function insertion pointer - inspecting code installing applications - installing python on linux - on mac - testing installation - on windows - instances creating defined methods - variables - instantiation int(function integers - integrated development environment (ide) interactive development environment see idle
9,785
interactive environment internet engineering task force (ietf) internet information server (iis) ioerror exception ipv (internet protocol version ) ipv (internet protocol version ) ipython irlib library - is not operator is operator isalnum(function isalpha(function isdecimal(function isdigit(function islower(function isnumeric(function isort isspace(function istitle(function isupper(function items(function iterable items *jj identifier java development time python versus using libraries in python javascript job opportunities data mining - embedded systems interaction gis it departments - network administration programming languages and qa real-time data analysis scientific tasks - specialty scripting - teaching join(function jpype library jquery jython *kkeyboardinterrupt exception keys(function - key/value pairs see dictionaries keywords topic komodo edit **kwargs argument list *llanguage integrated query (linq) last in/first out (lifo) launchpad lawrence livermore national library learning curve learnpython org tutorial len(function length checking less-than operator less-than or equal <operator letter analogy - - libraries defined finding online google maps httplib irlib - jpype numpy prettytable pyaudio - pycrypto pyqtgraph -
9,786
scipy socket sqlalchemy - third-party libraries - tkinter - twisted matrix license(command lifo (last in/first out) lightwave linefeed character lineno warning level linq (language integrated query) linux accessing python on installing python - python support lists accessing items in - computer view of - counter object for - creating - creating stacks using - functions for looping through modifying items in - mutable types negative indexes overview - range of values in searching in - sorting - using operators with zero-based indexes ljust(function __loader__ attribute local hostname - logical errors - logical operators listing of multiple comparisons for if statements - precedence loops break statements - continue statements - deque type and else clause - endless for loops - nesting - overview - pass clause - using with lists while statements - lower(function lstrip(function - option *mmac os accessing python - installing python - python support mantissa mathematic applications max(function maya membersclass membership operators memoryand floating-point values memoryerror exception mercurial version control - message warning level methods class - defined instance - instance variables and variable argument lists for - microsecond value microsoft disk operating system (ms-dos)
9,787
microsoft windows accessing idle - accessing python from command prompt - ignoring case in import statements installing python - opening pydoc application platform support mime (multipurpose internet mail extensions) - min(function minus sign ) minute value modo module warning level modules defined finding on disk - finding online from import statements - grouping code and - ignoring paths for importing - numeric processing opening pydoc application - quick-access documentation links - running scientific searching documentation - viewing attributes in - modules topic month value morphos motionbuilder ms-dos (microsoft disk operating system) multiline comments - multiplatform support - multiple processors multiplication operator ) multipurpose internet mail extensions (mime) - multithreaded applications mutable types * \ escape sequence __name__ attribute nasa (national space and aeronautics administration) negation operator ) nesting defined exception handling - if statements - loops - network administration new york stock exchange newline attribute not equal !operator not in operator not operator now(function nuke number sign ) numeric types complex numbers floating-point values - integers - reasons for multiple numpy library - option *oobjectdomain objects oct(function octal numeric values -oo option open(function
9,788
open source operands operating system (os/ ) operating system (os/ ) operators arithmetic - assignment binary bitwise - comparisons and identity logical membership overloading - overview - precedence relational - ternary unary using with lists optimizing code or operator ord(function orphaned projects os _exit(command os/ (operating system ) os/ (operating system ) os environattributes - os pathsep constant os remove(function os rmdir(function overloading functions operators - *p__package__ attribute padding strings with zeroes paint shop pro palmos parent classes parentheses ) partial functions pass clause overview - for while statements path environment variable - pathsdirectory pdoc - performance resources for using virtual environments perl php pil (python imaging library) platform support - playstation plus sign addition operator concatenation using operator precedence overloading - as unary operator using indentation with using with tuples pocket pc pop(function pop (post office protocol ) popleft(function ports - positional arguments post office protocol (pop ) precedenceoperator precision of decimal number prettytable library print(function testing installation - typing commands using in application - viewing command result - procedures commands and computers and -
9,789
procedures (continueddefined separating from user interface tasks as - processorsmultiple production servers production-grade classes program files directory programming application usage types - code reusability - common mistakes - communication with computer exceptions and - knowing multiple languages languages - python advantages protocoldefined prototypes psion purple text in idle put(function py files pyaudio library - pyco files pycrypto library pydbgr pydoc application opening - quick-access links - searching - pygame library pyinstaller - pyopengl pyqtgraph library - python advantages of applications written in cversus documentation - downloading - embedded python environment variables for installing on linux - installing on mac - installing on windows - java versus language comparisons online online documentation online tutorial organizations using - perl versus platform support - popularity of reporting problems uses for - using java libraries in web programming using python and xml processing site python command python gui see idle python imaging library (pil) pythoncaseok environment variable pythondebug environment variable pythondefaulthandler environment variable pythondoc library pythoneditors wiki pythonfaulthandler environment variable pythonhashseed environment variable pythonhome environment variable pythoninspect environment variable pythonioencoding environment variable pythonnousersite environment variable pythonoptimize environment variable
9,790
pythonpath environment variable pythonstartup environment variable pythonunbuffered environment variable pythonverbose environment variable python vim utility pythonware site - pythonwarnings environment variable pythonwritebytecode environment variable pyunit - *qq command - option qa (quality assurance) qnx quantum mechanics queue type defined sequence types using - quit(command - * \ escape sequence raising exceptions see also exceptionshandling defined overview - passing error information to caller - range checking range of values in list raspberry pi rdbms (relational database management system) read(function readability of code reading files - readme files real-time data analysis recordsdatabase red hat red hat package manager (rpm) regular expressions relational database management system (rdbms) relational operators listing of - precedence using with if statements - relative paths remove(function repetition repetitive tasks see loops replace(function reporting problems required arguments - resources common mistakes - ides learnpython org tutorial online documentation performance third-party libraries - unicode characters web programming xml - resourcewarning exception returning data from functions - reusable code - reverse(function rfind(function rindex(function risc os rjust(function rmtree(function
9,791
roundup issue tracker rpm (red hat package manager) rstrip(function runnable code running applications from command line defined from edit window in idle - - runtime errors - * - option - option scientific applications - scientific notation scipy library screenshots in book scribus sd (secure digital) searching irlib library - in lists - module documentation - in strings - second value secure digital (sd) seeding with random values selection tree self object semantic errors sequences - - see also lists serialization series server applications sets setters shell shortcut keys for idle shutil rmtree(function simple mail transfer protocol (smtp) - - simple object access protocol (soap) single quote ) single-line comments - __sizeof__ attribute smtp (simple mail transfer protocol) - - smtplib module soap (simple object access protocol) socket library softimage solaris solid state drive (ssd) sort(function sorting lists - sound technologies spaghetti code special characters - split(function splitlines(function sql (structured query language) sqlalchemy library - square brackets ] squeeze library ssd (solid state drive) stacks defined sequence types using - startswith(function str(function str type __str__(function strerror attribute - strings creating from characters - as dictionary keys formatting -
9,792
functions for - overview - searching in - selecting individual characters in - upper(function using special characters - as viewed by computers strip(function structured data structured query language (sql) subtraction operator ) sudo command suse linux swapcase(function switch statements - switchescommand-line - syntax concise errors in highlighting - sys exit(command sys path variable * \ (tab character) tcl (tool command language) ternary operator testing +applications installation - production servers and using pyunit - third-party libraries - throwing exceptions - see also exceptionshandling time(function tiobe web site title(function tkinter library - todo list management tool command language (tcl) tools bug-tracking sites ipython isort komodo edit mercurial version control - pdoc - pydbgr pyinstaller - pyunit - roundup issue tracker - virtualenv - topics keyword traceback trigger try block tuples defined hierarchy of - sequence types using - twisted matrix type(method typographical characters * \ escape sequence - option uac (user access control) ubuntu unary operators defined listing of precedence uncommenting lines unicode characters unit testing - universal serial bus (usb) unstructured data
9,793
beginning programming with python for dummies update(function upper(function usb (universal serial bus) usefulmodules site user access control (uac) user input - user interfaces * \ escape sequence - option - option valueerror exception variables assigning values class - defined determining type of instance - returning data from functions verbose mode version control - --version option vertical tab character virtualenv - visual basic vms (virtual memory system) - option *ww schools site - warning level web programming while statements nesting - overview - using - whitespaceremoving widgets library winsound module with statement writerow(function writing data to files - * \ escape sequence - option - option xml (extensible markup language) - *yyahoo! year value yellow dog linux youtube *zzero-based indexes zerodivisionerror exception zeroespadding with zfill(function zip files zope /os
9,794
john mueller is freelance author and technical editor he has writing in his bloodhaving produced books and more than articles to date the topics range from networking to artificial intelligence and from database management to heads-down programming some of his current books include windows command-line referencebooks on vba and visio cdesign and development manualand an ironpython programmer' guide his technical editing skills have helped more than authors refine the content of their manuscripts john has provided technical editing services to both data based advisor and coast compute magazines he has also contributed articles to magazines such as software quality connectiondevsourceinformitsql server professionalvisual +developerhard core visual basicasp netprosoftware test and performanceand visual basic developer be sure to read john' blog at when john isn' working at the computeryou can find him outside in the gardencutting woodor generally enjoying nature john also likes making winebaking cookiesand knitting when not occupied with anything elsehe makes glycerin soap and candleswhich come in handy for gift baskets you can reach john on the internet at john@johnmuellerbooks com john is also setting up website at free to take look and make suggestions on how he can improve it
9,795
some people are simply there in your life -as reliable as the day is long scott and pegg conderman are two such people -they have helped me through an extremely hard time simply by being themselves and knowing just what to do to make the day little better
9,796
thanks to my wiferebecca even though she is gone nowher spirit is in every book writein every word that appears on the page she believed in me when no one else would russ mullen deserves thanks for his technical edit of this book he greatly added to the accuracy and depth of the material you see here russ is always providing me with great urls for new products and ideas howeverit' the testing that russ does that helps most he' the sanity check for my work russ also has different computer equipment from mineso he' able to point out flaws that might not otherwise notice matt wagnermy agentdeserves credit for helping me get the contract in the first place and taking care of all the details that most authors don' really consider always appreciate his assistance it' good to know that someone wants to help number of people read all or part of this book to help me refine the approachtest the coding examplesand generally provide input that all readers wish they could have these unpaid volunteers helped in ways too numerous to mention here especially appreciate the efforts of eva beattieglenn russellemanuel jonasand michael sasseenwho provided general inputread the entire bookand selflessly devoted themselves to this project finallyi would like to thank kyle loopersusan christophersenand the rest of the editorial and production staff
9,797
senior acquisitions editorkyle looper project coordinatorpatrick redmond project and copy editorsusan christophersen cover image(cistock com glam- technical editorruss mullen editorial assistantclaire johnson sr editorial assistantcherie case
9,798
whowhenwhatwherewhyhoweasy environments programming primer coding conventions fussing with the flow script samples excellent -resources
9,799
charlene nielsen ccn@ualberta ca gis analyst in biological sciences www biology ualberta ca/gis