Lab 8: File I/O, Mutability vs. Assignment. Ling 1330/2330: Intro to Computational Linguistics Na-Rae Han
|
|
- Michael Stevens
- 6 years ago
- Views:
Transcription
1 Lab 8: File I/O, Mutability vs. Assignment Ling 1330/2330: Intro to Computational Linguistics Na-Rae Han
2 Objectives File I/O Writing to a file File I/O pitfalls File reference and absolute path Mutability vs. assignment Homework #3 Review Using textstats.py in IDLE shell Shell tips and tricks Tab completion 1/31/2017 2
3 Finally, working with a file How to write a script that reads in a text file and processes it? How to write out the result? File IO (Input/Output) Read in content of a file Write out to a file Write content into an existing file Also: "pickling" a Python data object A list, a dictionary,... NEXT CLASS 1/31/2017 3
4 Recap: Opening a text file for reading f is a file object name of file to read f = open('fox_in_sox.txt', 'r') ## read from f f.close() Closes the file. ALWAYS REMEMBER TO CLOSE YOUR FILE. 'r' for reading. It is default: can be omitted May also need to specify encoding: encoding='utf-8' 1/31/2017 4
5 Opening a text file for writing Just like reading, writing to a file also involves twin operations of creating & closing a file object. f = open('myresults.txt', 'w') ## write to f ## write more to f f.close() Closes the file. ALWAYS REMEMBER TO CLOSE YOUR FILE. 'w' for creating a new file for writing. If file exists, it will be overwritten!! Use 'a' instead for appending to an existing file. May also need to specify encoding: encoding='utf-8' 1/31/2017 5
6 (1) Writing a single string f = open('foo.txt', 'w') f.write('roses are red,\n') f.write('violets are blue.\n') f.close() 'w' option Opens file for writing f.write(str) Writes a single string to file f Creates file foo.txt, and writes a string, twice Roses are red, violets are blue. 1/31/2017 6
7 (2) Writing a list of strings rose = ['Roses are red\n', 'violets are blue.\n'] f = open('foo.txt', 'w') f.writelines(rose) f.close() f.writelines(list) Writes a list of strings to file f Creates file foo.txt, and writes two strings foo.txt Roses are red, violets are blue. 1/31/2017 7
8 .write() works one string at a time f = open('foo.txt', 'w') f.write('roses are red,\n', 'violets are blue.\n') f.close() To write a list of strings in one swoop, use ======================== RESTART =====================.writelines() instead. Traceback (most recent call last): File "F:\foo.py", line 3, in <module> f.write('roses are red,\n', 'violets are blue.\n') TypeError: function takes exactly 1 argument (2 given) >>> 1/31/2017 8
9 Line breaks must be supplied f = open('foo.txt', 'w') f.write('roses are red,') f.write('violets are blue.') f.close() Without \n, these will be printed on a single line. foo.txt Roses are red,violets are blue. print() by default adds a line break..write() and.writelines() DO NOT add a line break. Line breaks '\n' must be explicitly supplied. 1/31/2017 9
10 Can only write string types f = open('foo.txt', 'w') pi = f.write('the value of pi is:\n') f.write(pi) f.close() pi is float type..write() can only take a string argument. =========================== RESTART ========== Traceback (most recent call last): File "F:\foo.py", line 5, in <module> f.write(pi) TypeError: expected a character buffer object >>> 1/31/
11 Can only write string types f = open('foo.txt', 'w') pi = f.write('the value of pi is:\n') f.write(str(pi)) f.close() str() turns pi into a string. foo.txt The value of pi is: write() only takes a string as an argument. Any other data types (integer, float, etc.) must be first converted into string using str() function. 1/31/
12 Don't forget to close file f = open('foo.txt', 'w') f.write('roses are red\n,') f.write('violets are blue\n.') Forgot to specify f.close() foo.txt File writing happens through buffers. Always remember to CLOSE YOUR FILE. Writing out to a file actually happens when your writing buffer is full or the file is closed. So, if you forget to close your file, you might find your output file to be either empty or halfway written. 1/31/
13 Practice 3 minutes Finish the script so it produces the output file. chom = 'Colorless green ideas sleep furiously.' f = open('foo.txt', 'w') for wd in chom.split() : f.write(wd+'\n') f.close()?? foo.txt Colorless green ideas sleep furiously. 1/31/
14 Practice Finish the script so it produces the output file. chom = 'Colorless green ideas sleep furiously.' f = open('foo.txt', 'w') for wd in chom.split() : f.write(wd+'\n') f.close() foo.txt Colorless green ideas sleep furiously. 1/31/
15 Practice 3 minutes Modify the script so it produces the output file. chom = 'Colorless green ideas sleep furiously.' f = open('foo.txt', 'w') for wd in chom.split() : f.write(wd+'\n')?? f.close() foo.txt Colorless is 9 characters long. green is 5 characters long. ideas is 5 characters long. sleep is 5 characters long. furiously. is 10 characters long. 1/31/
16 Practice 3 minutes Modify the script so it produces the output file. chom = 'Colorless green ideas sleep furiously.' f = open('foo.txt', 'w') for wd in chom.split() : f.write(wd+' is '+str(len(wd))+' characters long.\n') f.close() foo.txt Colorless is 9 characters long. green is 5 characters long. ideas is 5 characters long. sleep is 5 characters long. furiously. is 10 characters long. 1/31/
17 Venturing out and into the jungle (aka your computer's hard drive) So far, we have been dealing with files right INSIDE your Python's current WD. We can reference them by their names only, "tale.txt", "fox_in_sox.txt", etc. What about files that are elsewhere on your hard drive? We have to understand and use file and directory path. 1/31/
18 How to find absolute file path Mac Right-click Get Info Windows Right-click Properties 1/31/
19 Absolute file path A reference to a file can include a complete file path starting from the very top of the directory hierarchy: absolute file path OS-X, Linux, Unix: Windows: /Users/narae/Documents/test.txt Starts with the root '/' C:\Users\narae\Documents\test.txt Starts with drive letter: 'C:', 'D:', etc. Uses backslash "\" instead of slash "/" PROBLEMATIC, because backslash has a special meaning in Python!! 1/31/
20 Windows file path in Python Windows uses backslash "\", which is a special character in Python. As a result, Python gives you multiple ways to reference. file = 'C:/Users/narae/Desktop/test.txt' file = 'C:\\Users\\narae\\Desktop\\test.txt' Use slash "/" instead, which Python internally converts to "\" Use backslash "\" but escape every instance file = r'c:\users\narae\desktop\test.txt' r' ' forces the following string ' ' to be interpreted as literal characters Use backslash "\" but instead of escaping use r ('raw string') prefix 1/31/
21 Current working directory Software applications typically operate on the notion of current working directory (WD or CWD) Directory that the application is currently operating in. Typically, "File Open" and "File Save" dialog windows will default to this directory. With Python IDLE, the default WD is: /Users/naraehan/Documents C:\Program Files (x86)\python35-32 (Mac) (Windows) Not convenient at all. We already changed these to our Python script directory!! Windows instruction Mac instruction 1/31/
22 Relative file path, starting from WD A file's location can be specified relative to Working Directory. When a file reference does not start from the top, the starting point is assumed to be the WD. File is located in WD: f = open('fox_in_sox.txt') In a directory called 'data' inside WD: f = open('data/fox_in_sox.txt') Located "one directory up" from WD (WD's parent directory) f = open('../fox_in_sox.txt').. is a short-hand for the parent directory 1/31/
23 File location and path: WD When a file is referred to by its name only, it is assumed to be in the current working directory (WD or CWD). In scripts, WD is the directory where your script is. f = open('fox_in_sox.txt') # read file f.close() outf = open('results.txt', 'w') # write out to file outf.close() foo.py File to read must be in the same directory as the script foo.py File will be created in the directory where foo.py is 1/31/
24 WD in Python shell In IDLE shell or in command-line, WD may be initially set to: Your Python script folder, if you have customized your IDLE environment. If you haven't: /Users/username/Documents C:\Program Files (x86)\python35-32 (Mac) (Windows) >>> f = open('fox_in_sox.txt') Traceback (most recent call last): File "<pyshell#48>", line 1, in <module> f = open('fox_in_sox.txt') IOError: [Errno 2] No such file or directory: 'fox_in_sox.txt' Error: The file is not in your shell's current working directory. 1/31/
25 Discovering and changing your WD >>> import os >>> os.getcwd() 'D:\\Lab' os module must be imported first. os.getcwd() displays "current WD" >>> os.chdir('c:/users/narae/documents') >>> os.getcwd() 'C:\\Users\\narae\\Documents' Windows-internal representation. Directories are separated by '\' os.chdir() changes current WD. It is now set to C:\Users\narae\Documents (Windows) In OS X, directories look like /Users/naraehan/Documents 1/31/
26 File path & WD, a summary Referencing a file with its absolute path: '/Users/naraehan/Documents/fox_in_sox.txt' 'C:/Users/naraehan/Documents/fox_in_sox.txt' always works. OS-X, Linux Windows If referencing with shorthand: 'fox_in_sox.txt', the file has to be in the current WD (working directory). In a SCRIPT: WD is where the script is file and script should be in the same dir. After your script is executed in IDLE shell, shell's WD changes to the script's location. In IDLE shell, your initial WD depends on your setting. Find out WD and change it using the os module: os.getcwd(), os.chdir() Beware: after running a script, your shell's WD changes to the script's location. 1/31/
27 File path & WD, recommended practice If you configured your Python IDLE, it conveniently launches with your own Python script directory as the initial WD. Keep all your scripts,.txt input and output files in there File I/O is relatively hassle free. If you need to work with files somewhere else, be mindful of your WD and the absolute file path. 1/31/
28 Copying a list content, 1 st try >>> >>> sim = ['Homer', 'Marge', 'Bart', 'Lisa', 'Maggie'] gran = ['Abe', 'Mona'] How to build a new list of all Simpson family members? 1/31/
29 Copying a list content, 1 st try >>> sim = ['Homer', 'Marge', 'Bart', 'Lisa', 'Maggie'] >>> gran = ['Abe', 'Mona'] >>> allsim = sim >>> allsim.extend(gran) >>> allsim ['Homer', 'Marge', 'Bart', 'Lisa', 'Maggie', 'Abe', 'Mona'] >>> sim ['Homer', 'Marge', 'Bart', 'Lisa', 'Maggie', 'Abe', 'Mona'] >>> Fail!! sim also changed. What's going on?? 1/31/
30 Mutability strikes back Copying a string "Copying" a list >>> x = 'hello' >>> x2 = x >>> x2 += '!!' >>> x2 'hello!!' >>> x 'hello' >>> >>> x = [1, 2, 3] >>> x2 = x >>> x2.append(4) >>> x2 [1, 2, 3, 4] >>> x [1, 2, 3, 4] >>> What's going on?? We need to take a closer look at assignment vs. mutability. 1/31/
31 Assignment: under the hood x = 3 Binding a variable in Python means setting a name to hold a reference to some object. Assignment creates references, not copies. Names in Python do not have an intrinsic type; objects do. Python determines the type of the reference automatically based on the data object assigned to it. You create a name the first time it appears on the left side of an assignment statement: x = 3 A reference is deleted via garbage collection after any names bound to it have passed out of scope. 1/31/
32 Understanding reference semantics Assignment manipulates references: it's all about pointing. var2 = var1 does not make a copy of the object var1 references var2 = var1 makes var2 reference the object var1 references! var1 int 3 var2 1/31/
33 Reference vs. immutable types So, for immutable datatypes (integers, floats, strings) assignment behaves as you would expect: >>> x = 'hi' # Creates 'hi', name x refers to it >>> x2 = x # Creates name x2, refers to 'hi' >>> x2 += '!!' # Creates ref for 'hi!!', changes x2 >>> x2 'hi!!' >>> x # No effect on x, still refers to 'hi' 'hi' x 'hi' int 1/31/
34 Reference vs. immutable types So, for immutable datatypes (integers, floats, strings) assignment behaves as you would expect: >>> x = 'hi' # Creates 'hi', name x refers to it >>> x2 = x # Creates name x2, refers to 'hi' >>> x2 += '!!' # Creates ref for 'hi!!', changes x2 >>> x2 'hi!!' >>> x # No effect on x, still refers to 'hi' 'hi' x 'hi' int x2 1/31/
35 Reference vs. immutable types So, for immutable datatypes (integers, floats, strings) assignment behaves as you would expect: >>> x = 'hi' # Creates 'hi', name x refers to it >>> x2 = x # Creates name x2, refers to 'hi' >>> x2 += '!!' # Creates ref for 'hi!!', changes x2 >>> x2 'hi!!' >>> x # No effect on x, still refers to 'hi' 'hi' x x2 'hi' int 'hi!!' int x and x2 now have different values. 1/31/
36 Reference vs. mutable types Mutable data types (list, dictionaries) behave differently! Method functions change these data in place, so >>> x = [1,2,3] # x references list [1,2,3] >>> x2 = x # x2 now references what x references >>> x2.append(4) # Changes the original list in memory >>> x2 [1, 2, 3, 4] >>> x # x too points to the changed list! [1, 2, 3, 4] x int 1/31/
37 Reference vs. mutable types Mutable data types (list, dictionaries) behave differently! Method functions change these data in place, so >>> x = [1,2,3] # x references list [1,2,3] >>> x2 = x # x2 now references what x references >>> x2.append(4) # Changes the original list in memory >>> x2 [1, 2, 3, 4] >>> x # x too points to the changed list! [1, 2, 3, 4] x x int 1/31/
38 Reference vs. mutable types Mutable data types (list, dictionaries) behave differently! Method functions change these data in place, so >>> x = [1,2,3] # x references list [1,2,3] >>> x2 = x # x2 now references what x references >>> x2.append(4) # Changes the original list in memory >>> x2 [1, 2, 3, 4] >>> x # x too points to the changed list! [1, 2, 3, 4] x x int 1/31/
39 Reference vs. mutable types Mutable data types (list, dictionaries) behave differently! Method functions change these data in place, so >>> x = [1,2,3] # x references list [1,2,3] >>> x2 = x # x2 now references what x references >>> x2.append(4) # Changes the original list in memory >>> x2 [1, 2, 3, 4] >>> x # x too points to the changed list! [1, 2, 3, 4] x x int x and x2 refer to the same object in memory! When x is modified, x2 also changes 1/31/
40 Copying a list content, 1 st try >>> sim = ['Homer', 'Marge', 'Bart', 'Lisa', 'Maggie'] >>> gran = ['Abe', 'Mona'] >>> allsim = sim >>> allsim.extend(gran) >>> allsim ['Homer', 'Marge', 'Bart', 'Lisa', 'Maggie', 'Abe', 'Mona'] >>> sim ['Homer', 'Marge', 'Bart', 'Lisa', 'Maggie', 'Abe', 'Mona'] >>> Fail!! sim also changed. So! How do we create a *new* list object from an existing list? 1/31/
41 Clone a list through [:] >>> >>> >>> >>> >>> ['Homer', 'Marge', 'Bart', 'Lisa', 'Maggie', 'Abe', 'Mona'] >>> ['Homer', 'Marge', 'Bart', 'Lisa', 'Maggie'] >>> sim = ['Homer', 'Marge', 'Bart', 'Lisa', 'Maggie'] gran = ['Abe', 'Mona'] allsim = sim[:] allsim.extend(gran) allsim sim [:] returns a whole slice of sim, as a *new list object* SUCCESS! 1/31/
42 + merges 2 lists into a new one >>> >>> >>> >>> ['Homer', 'Marge', 'Bart', 'Lisa', 'Maggie', 'Abe', 'Mona'] >>> ['Homer', 'Marge', 'Bart', 'Lisa', 'Maggie'] >>> sim = ['Homer', 'Marge', 'Bart', 'Lisa', 'Maggie'] gran = ['Abe', 'Mona'] allsim = sim + gran allsim sim + merges two lists and returns it SUCCESS! 1/31/
43 Creating a *new* list obj from existing [:] slicing >>> x = [1,2,3,4,5] >>> x[2:] [3, 4, 5] >>> x[:] [1, 2, 3, 4, 5] >>> + operator >>> x = [1,2,3,4] >>> y = [5,6,7] >>> x + y [1, 2, 3, 4, 5, 6, 7] >>> x + [100, 200] [1, 2, 3, 4, 100, 200] >>> The whole slice [:] clones the entire list and returns it as a new object. list1 + list2 returns a new list created by concatenating the contents. 1/31/
44 Try it out 2 minutes >>> x = 'hello' >>> x2 = x >>> x2 += '!!' >>> x2 'hello!!' >>> x 'hello' >>> >>> x = [1,2,3,4] >>> y = [5,6,7] >>> x + y [1, 2, 3, 4, 5, 6, 7] >>> x + [100, 200] [1, 2, 3, 4, 100, 200] >>> >>> x = [1, 2, 3] >>> x2 = x >>> x2.append(4) >>> x2 [1, 2, 3, 4] >>> x [1, 2, 3, 4] >>> x[1:] [2, 3, 4] >>> x[:] [1, 2, 3, 4] >>> x3 = x[:] >>> x3.append(100) >>> x3 [1, 2, 3, 4, 100] >>> x [1, 2, 3, 4] >>> 1/31/
45 Congratulations! You have now learned all of essential Python. From this point on, we will focus on: Applying the knowledge to real-world problems How to process text for basic statistics (already started) How to work with a corpus How to search through text data Learn a few additional tricks List comprehension Pickling Regular expressions 1/31/
46 It is time to REVIEW We have learned a WHOLE LOT so far. First of all, you must KNOW WHAT WE LEARNED. This is a GOOD time to REVIEW and make sure you have a good command of Python basics. Secondly, you must BE ABLE TO SYNTHESIZE from what you know. As you review the slides and tutorials, you will find yourself nodding along. But reading comprehension gets you only so far you should write them yourself! Next level up, you should be able to apply your coding skills to NOVEL PROBLEMS wd = 'penguin' rev = '' for i in wd : rev = i + rev print(rev) print(rev) 1/31/
47 A common misconception Wow. So many commands. How am I going to memorize all these!!! TRUTH: Nobody, even seasoned programmers, codes solely from memory. Rather than trying to commit everything to memory, you should: have a good overall knowledge of programming structure and practices be willing to explore have your references handy know how to look stuff up! 1/31/
48 Be more efficient Do you find coding tedious? Make sure you are: Fully utilizing the SHELL side for testing. Remember the "Rookie vs. Pro ways" video? Utilizing your command-line history. Don't re-type your commands! Change Ctrl+p/n to up arrow ( ) and down arrow ( ) Using dir() and help(). Using TAB completion and tooltips. Will show you in a moment. 1/31/
49 Homework 3 review Online resources The power of functions and modular programming Building up complex data through pipelining n-gram functions How to generalize? Why insist on tuple format? gettypes() revisited.keys() not necessary after all! There are now two ways of building a frequency dictionary. 1/31/
50 Norvig's data: word lists words.js enable1.txt What are they? How big? 1/31/
51 Norvig's data: 1- & 2-grams count_1w.txt count_2w.txt Where do they come from? 1/31/
52 COCA n-gram lists 2-grams 66 a ba 41 a babble 28 a babbling 159 a babe 83 a baboon 9744 a baby 31 a baby-faced 122 a baby-sitter 237 a babysitter 23 a babysitting 95 a baccalaureate 71 a bach 1342 a bachelor 27 a bachelorette 53 a bachelors 1924 a back 38 a back-and-forth 24 a back-door 29 a back-to-basics 27 a back-to-school 100 a back-up 3-grams Anything you noticed? 33 a ba in 35 a babble of 33 a babe in 316 a baby and 25 a baby as 73 a baby at 32 a baby before 53 a baby bird 57 a baby boomer 34 a baby born 146 a baby boy 36 a baby brother 29 a baby by 34 a baby can 45 a baby carriage 45 a baby crying 39 a baby doll 47 a baby for 41 a baby from 224 a baby girl 35 a baby grand 52
53 What did you find? 1/31/
54 Word bigram function def getword2grams(wds) : "Takes a tokenized word list, returns a bigram list" bigrams = [] for i in range(len(txt)-1) : gram = tuple(txt[i:i+2]) bigrams.append(gram) return bigrams Why was it necessary to make the n-grams a tuple type? What is wrong with lists? >>> chomtoks ['colorless', 'green', 'ideas', 'sleep', 'furiously', '.'] >>> getword2grams(chomtoks) [('colorless', 'green'), ('green', 'ideas'), ('ideas', 'sleep'), ('sleep', 'furiously'), ('furiously', '.')] >>> 1/31/
55 It's all about the pipeline getword2grams [('rose', 'is'), ('is', 'a'), ('a', 'rose'), ('rose', 'is'), ('is', 'a'), ('a', 'rose'), ('rose', '.')] Eventually, we want to produce an n-gram frequency dictionary. getfreq {('rose', 'is'): 2, ('a', 'rose'): 2, ('rose', '.'): 1, ('is', 'a'): 2} Tuples (immutable!) can be a dictionary key. Lists and other mutable types cannot. 1/31/
56 Generalized n-gram function def getwordngrams(wds, n) : "Takes a tokenized word list, returns an n-gram list" ngrams = [] for i in range(len(txt)-n+1)? : gram = tuple(txt[i:i+n]) ngrams.append(gram) return ngrams >>> chomtoks ['colorless', 'green', 'ideas', 'sleep', 'furiously', '.'] >>> getwordngrams(chomtoks, 4) [('colorless', 'green', 'ideas', 'sleep'), ('green', 'ideas', 'sleep', 'furiously'), ('ideas', 'sleep', 'furiously', '.')] >>> 1/31/
57 Generalized n-gram function def getwordngrams(wds, n) : "Takes a tokenized word list, returns an n-gram list" ngrams = [] for i in range(len(txt)-n+1) : gram = tuple(txt[i:i+n]) ngrams.append(gram) return ngrams >>> chomtoks ['colorless', 'green', 'ideas', 'sleep', 'furiously', '.'] >>> getwordngrams(chomtoks, 4) [('colorless', 'green', 'ideas', 'sleep'), ('green', 'ideas', 'sleep', 'furiously'), ('ideas', 'sleep', 'furiously', '.')] >>> 1/31/
58 Building various data objects 'Rose is a rose is a rose is a rose.' gettokens gettypefreq gettypes ['rose', 'is', 'a', 'rose', 'is', 'a', 'rose', 'is', 'a', 'rose', '.']?? {'a': 3, 'is': 3, '.': 1, 'rose': 4} getxfreqwords ['.', 'a', 'is', 'rose'] x = 3 x = 2 getxlengthwords Can we build a type frequency dictionary from a token list? ['a', 'is', 'rose'] ['is', 'rose'] 1/31/
59 More than one way to build 'Rose is a rose is a rose is a rose.' gettokens gettypefreq gettypes ['rose', 'is', 'a', 'rose', 'is', 'a', 'rose', 'is', 'a', 'rose', '.'] getfreq {'a': 3, 'is': 3, '.': 1, 'rose': 4} getxfreqwords ['.', 'a', 'is', 'rose'] x = 3 x = 2 getxlengthwords Yep! Pass it through getfreq(), a general-purpose frequency counter function. ['a', 'is', 'rose'] ['is', 'rose'] 1/31/
60 Simplifying functions def gettypes(txt) : """Takes a piece of text (a single string), returns an alphabetically sorted list of unique word types. """ tfreq = gettypefreq(txt) return sorted(tfreq.keys()) same as: sorted(tfreq) sorted() can take a list, string, and returns a list. When taking a dictionary, it returns a sorted list of dictionary keys. 1/31/
61 Wrapping up Next class: Pickling Handling multiple text files, large text files Exercise 5 File I/O with O. Henry Essentially the same as HW3, but writing results out to a file HW3 solution will be posted on CourseWeb, as an attachment to the original submission link 1/31/
Lesson 4: Type Conversion, Mutability, Sequence Indexing. Fundamentals of Text Processing for Linguists Na-Rae Han
Lesson 4: Type Conversion, Mutability, Sequence Indexing Fundamentals of Text Processing for Linguists Na-Rae Han Objectives Python data types Mutable vs. immutable object types How variable assignment
More informationLab 6: Data Types, Mutability, Sorting. Ling 1330/2330: Computational Linguistics Na-Rae Han
Lab 6: Data Types, Mutability, Sorting Ling 1330/2330: Computational Linguistics Na-Rae Han Objectives Data types and conversion Tuple Mutability Sorting: additional parameters Text processing overview
More informationLab 1: Course Intro, Getting Started with Python IDLE. Ling 1330/2330 Computational Linguistics Na-Rae Han
Lab 1: Course Intro, Getting Started with Python IDLE Ling 1330/2330 Computational Linguistics Na-Rae Han Objectives Course Introduction http://www.pitt.edu/~naraehan/ling1330/index.html Student survey
More informationLab 3: for and while Loops, Indexing. Ling 1330/2330: Computational Linguistics Na-Rae Han
Lab 3: for and while Loops, Indexing Ling 1330/2330: Computational Linguistics Na-Rae Han Objectives Split vs. join Loops for loop while loop Indexing List and string indexing & slicing Tips How to program
More informationLab 7: Reading Files, Importing, Bigram Function. Ling 1330/2330: Computational Linguistics Na-Rae Han
Lab 7: Reading Files, Importing, Bigram Function Ling 1330/2330: Computational Linguistics Na-Rae Han Objectives Importing Reading text files range() Bigram function More sorting with sorted() sorted()
More informationPython I. Some material adapted from Upenn cmpe391 slides and other sources
Python I Some material adapted from Upenn cmpe391 slides and other sources Overview Names & Assignment Data types Sequences types: Lists, Tuples, and Strings Mutability Understanding Reference Semantics
More informationSome material adapted from Upenn cmpe391 slides and other sources
Some material adapted from Upenn cmpe391 slides and other sources History Installing & Running Python Names & Assignment Sequences types: Lists, Tuples, and Strings Mutability Understanding Reference Semantics
More informationGIS 4653/5653: Spatial Programming and GIS. More Python: Statements, Types, Functions, Modules, Classes
GIS 4653/5653: Spatial Programming and GIS More Python: Statements, Types, Functions, Modules, Classes Statement Syntax The if-elif-else statement Indentation and and colons are important Parentheses and
More informationLab 18: Regular Expressions in Python. Ling 1330/2330: Intro to Computational Linguistics Na-Rae Han
Lab 18: Regular Expressions in Python Ling 1330/2330: Intro to Computational Linguistics Na-Rae Han Learning to use regex in Python Na-Rae's tutorials: http://www.pitt.edu/~naraehan/python3/re.html http://www.pitt.edu/~naraehan/python3/more_list_comp.html
More informationThe current topic: Python. Announcements. Python. Python
The current topic: Python Announcements! Introduction! reasons for studying languages! language classifications! simple syntax specification Object-oriented programming: Python Types and values Syntax
More informationInteractive use. $ python. >>> print 'Hello, world!' Hello, world! >>> 3 $ Ctrl-D
1/60 Interactive use $ python Python 2.7.5 (default, Mar 9 2014, 22:15:05) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin Type "help", "copyright", "credits" or "license" for more information.
More informationCIS192: Python Programming
CIS192: Python Programming Introduction Harry Smith University of Pennsylvania January 18, 2017 Harry Smith (University of Pennsylvania) CIS 192 Lecture 1 January 18, 2017 1 / 34 Outline 1 Logistics Rooms
More informationInteractive use. $ python. >>> print 'Hello, world!' Hello, world! >>> 3 $ Ctrl-D
1/58 Interactive use $ python Python 2.7.5 (default, Mar 9 2014, 22:15:05) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin Type "help", "copyright", "credits" or "license" for more information.
More informationIntroduction to Python
Introduction to Python Version 1.1.5 (12/29/2008) [CG] Page 1 of 243 Introduction...6 About Python...7 The Python Interpreter...9 Exercises...11 Python Compilation...12 Python Scripts in Linux/Unix & Windows...14
More informationThe Dynamic Typing Interlude
CHAPTER 6 The Dynamic Typing Interlude In the prior chapter, we began exploring Python s core object types in depth with a look at Python numbers. We ll resume our object type tour in the next chapter,
More informationAnnouncements for this Lecture
Lecture 6 Objects Announcements for this Lecture Last Call Quiz: About the Course Take it by tomorrow Also remember survey Assignment 1 Assignment 1 is live Posted on web page Due Thur, Sep. 18 th Due
More informationPart III Appendices 165
Part III Appendices 165 Appendix A Technical Instructions Learning Outcomes This material will help you learn how to use the software you need to do your work in this course. You won t be tested on it.
More informationPython Class-Lesson1 Instructor: Yao
Python Class-Lesson1 Instructor: Yao What is Python? Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined
More informationFiles on disk are organized hierarchically in directories (folders). We will first review some basics about working with them.
1 z 9 Files Petr Pošík Department of Cybernetics, FEE CTU in Prague EECS, BE5B33PRG: Programming Essentials, 2015 Requirements: Loops Intro Information on a computer is stored in named chunks of data called
More informationPython Intro GIS Week 1. Jake K. Carr
GIS 5222 Week 1 Why Python It s simple and easy to learn It s free - open source! It s cross platform IT S expandable!! Why Python: Example Consider having to convert 1,000 shapefiles into feature classes
More informationProgramming to Python
Programming to Python Sept., 5 th Slides by M. Stepp, M. Goldstein, M. DiRamio, and S. Shah Compiling and interpreting Many languages require you to compile (translate) your program into a form that the
More informationData Structures. Lists, Tuples, Sets, Dictionaries
Data Structures Lists, Tuples, Sets, Dictionaries Collections Programs work with simple values: integers, floats, booleans, strings Often, however, we need to work with collections of values (customers,
More informationLab 20: Regular Expressions in Python. Ling 1330/2330: Computational Linguistics Na-Rae Han
Lab 20: Regular Expressions in Python Ling 1330/2330: Computational Linguistics Na-Rae Han Exercise 10: regexing Jobs [x X] [xx] (x X) Within [... ], all characters are already considered forming a set,
More informationPython. Karin Lagesen.
Python Karin Lagesen karin.lagesen@bio.uio.no Plan for the day Basic data types data manipulation Flow control and file handling Functions Biopython package What is programming? Programming: ordered set
More informationThe Pyth Language. Administrivia
Administrivia The Pyth Language Lecture 5 Please make sure you have registered your team, created SSH keys as indicated on the admin page, and also have electronically registered with us as well. Prof.
More informationPython Basics. Lecture and Lab 5 Day Course. Python Basics
Python Basics Lecture and Lab 5 Day Course Course Overview Python, is an interpreted, object-oriented, high-level language that can get work done in a hurry. A tool that can improve all professionals ability
More informationTable of Contents EVALUATION COPY
Table of Contents Introduction... 1-2 A Brief History of Python... 1-3 Python Versions... 1-4 Installing Python... 1-5 Environment Variables... 1-6 Executing Python from the Command Line... 1-7 IDLE...
More informationIntro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming
Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals
More informationProgramming for Engineers in Python. Recitation 1
Programming for Engineers in Python Recitation 1 Plan Administration: Course site Homework submission guidelines Working environment Python: Variables Editor vs. shell Homework 0 Python Cont. Conditional
More informationIntroduction to python
Introduction to python 13 Files Rossano Venturini rossano.venturini@unipi.it File System A computer s file system consists of a tree-like structured organization of directories and files directory file
More informationComputer Sciences 368 Scripting for CHTC Day 3: Collections Suggested reading: Learning Python
Day 3: Collections Suggested reading: Learning Python (3rd Ed.) Chapter 8: Lists and Dictionaries Chapter 9: Tuples, Files, and Everything Else Chapter 13: while and for Loops 1 Turn In Homework 2 Homework
More informationHistory Installing & Running Python Names & Assignment Sequences types: Lists, Tuples, and Strings Mutability
History Installing & Running Python Names & Assignment Sequences types: Lists, Tuples, and Strings Mutability Some material adapted from Upenn cmpe391 slides and other sources Invented in the Netherlands,
More informationLecture 3: Processing Language Data, Git/GitHub. LING 1340/2340: Data Science for Linguists Na-Rae Han
Lecture 3: Processing Language Data, Git/GitHub LING 1340/2340: Data Science for Linguists Na-Rae Han Objectives What do linguistic data look like? Homework 1: What did you process? How does collaborating
More informationSTSCI Python Introduction. Class URL
STSCI Python Introduction Class 2 Jim Hare Class URL www.pst.stsci.edu/~hare Each Class Presentation Homework suggestions Example files to download Links to sites by each class and in general I will try
More informationLists How lists are like strings
Lists How lists are like strings A Python list is a new type. Lists allow many of the same operations as strings. (See the table in Section 4.6 of the Python Standard Library Reference for operations supported
More informationToday. Review. Unix as an OS case study Intro to Shell Scripting. What is an Operating System? What are its goals? How do we evaluate it?
Today Unix as an OS case study Intro to Shell Scripting Make sure the computer is in Linux If not, restart, holding down ALT key Login! Posted slides contain material not explicitly covered in class 1
More informationGE PROBLEM SOVING AND PYTHON PROGRAMMING. Question Bank UNIT 1 - ALGORITHMIC PROBLEM SOLVING
GE8151 - PROBLEM SOVING AND PYTHON PROGRAMMING Question Bank UNIT 1 - ALGORITHMIC PROBLEM SOLVING 1) Define Computer 2) Define algorithm 3) What are the two phases in algorithmic problem solving? 4) Why
More informationProgramming Fundamentals and Python
Chapter 2 Programming Fundamentals and Python This chapter provides a non-technical overview of Python and will cover the basic programming knowledge needed for the rest of the chapters in Part 1. It contains
More informationGetting Started Values, Expressions, and Statements CS GMU
Getting Started Values, Expressions, and Statements CS 112 @ GMU Topics where does code go? values and expressions variables and assignment 2 where does code go? we can use the interactive Python interpreter
More informationProgramming for Engineers in Python. Autumn
Programming for Engineers in Python Autumn 2011-12 Plan Administration: Course site Homework submission guidelines Working environment Python: Variables Editor vs. shell Homework 0 Python Cont. Conditional
More informationPython for Non-programmers
Python for Non-programmers A Gentle Introduction 1 Yann Tambouret Scientific Computing and Visualization Information Services & Technology Boston University 111 Cummington St. yannpaul@bu.edu Winter 2013
More informationWhat we already know. more of what we know. results, searching for "This" 6/21/2017. chapter 14
What we already know chapter 14 Files and Exceptions II Files are bytes on disk. Two types, text and binary (we are working with text) open creates a connection between the disk contents and the program
More informationIntroduction to Unix
Introduction to Unix Part 1: Navigating directories First we download the directory called "Fisher" from Carmen. This directory contains a sample from the Fisher corpus. The Fisher corpus is a collection
More informationWorksheet 6: Basic Methods Methods The Format Method Formatting Floats Formatting Different Types Formatting Keywords
Worksheet 1: Introductory Exercises Turtle Programming Calculations The Print Function Comments Syntax Semantics Strings Concatenation Quotation Marks Types Variables Restrictions on Variable Names Long
More informationLab 2: input(), if else, String Operations, Variable Assignment. Ling 1330/2330: Computational Linguistics Na-Rae Han
Lab 2: input(), if else, String Operations, Variable Assignment Ling 1330/2330: Computational Linguistics Na-Rae Han Objectives Learn Python basics Taking input from keyboard with input() Commenting Comparison
More informationShell Programming Overview
Overview Shell programming is a way of taking several command line instructions that you would use in a Unix command prompt and incorporating them into one program. There are many versions of Unix. Some
More informationOverview of the UNIX File System
Overview of the UNIX File System Navigating and Viewing Directories Adapted from Practical Unix and Programming Hunter College Copyright 2006 Stewart Weiss The UNIX file system The most distinguishing
More informationDEBUGGING TIPS. 1 Introduction COMPUTER SCIENCE 61A
DEBUGGING TIPS COMPUTER SCIENCE 61A 1 Introduction Every time a function is called, Python creates what is called a stack frame for that specific function to hold local variables and other information.
More informationFILE HANDLING AND EXCEPTIONS
FILE HANDLING AND EXCEPTIONS INPUT We ve already seen how to use the input function for grabbing input from a user: input() >>> print(input('what is your name? ')) What is your name? Spongebob Spongebob
More informationCS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG
CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG 1 Notice Reading Assignment Chapter 1: Introduction to Java Programming Homework 1 It is due this coming Sunday
More informationIntroduction to Linux
Introduction to Linux The command-line interface A command-line interface (CLI) is a type of interface, that is, a way to interact with a computer. Window systems, punched cards or a bunch of dials, buttons
More informationOverview of OOP. Dr. Zhang COSC 1436 Summer, /18/2017
Overview of OOP Dr. Zhang COSC 1436 Summer, 2017 7/18/2017 Review Data Structures (list, dictionary, tuples, sets, strings) Lists are enclosed in square brackets: l = [1, 2, "a"] (access by index, is mutable
More informationPython Tutorial. CSE 3461: Computer Networking
Python Tutorial CSE 3461: Computer Networking 1 Outline Introduction to Python CSE Environment Tips for Python Primitive Types Tips for Encoding/Decoding an IP Address 2 Intro to Python Dynamically typed,
More informationBioinformatics? Reads, assembly, annotation, comparative genomics and a bit of phylogeny.
Bioinformatics? Reads, assembly, annotation, comparative genomics and a bit of phylogeny stefano.gaiarsa@unimi.it Linux and the command line PART 1 Survival kit for the bash environment Purpose of the
More informationLECTURE 4 Python Basics Part 3
LECTURE 4 Python Basics Part 3 INPUT We ve already seen two useful functions for grabbing input from a user: raw_input() Asks the user for a string of input, and returns the string. If you provide an argument,
More informationAccelerating Information Technology Innovation
Accelerating Information Technology Innovation http://aiti.mit.edu/program/philippines-summer-2012/ Philippines Summer 2012 Lecture 1 Introduction to Python June 19, 2012 Agenda About the Course What is
More informationPython in 10 (50) minutes
Python in 10 (50) minutes https://www.stavros.io/tutorials/python/ Python for Microcontrollers Getting started with MicroPython Donald Norris, McGrawHill (2017) Python is strongly typed (i.e. types are
More informationLevel 3 Computing Year 2 Lecturer: Phil Smith
Level 3 Computing Year 2 Lecturer: Phil Smith We looked at: Previously Reading and writing files. BTEC Level 3 Year 2 Unit 16 Procedural programming Now Now we will look at: Appending data to existing
More information\n is used in a string to indicate the newline character. An expression produces data. The simplest expression
Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of
More information1. BASICS OF PYTHON. JHU Physics & Astronomy Python Workshop Lecturer: Mubdi Rahman
1. BASICS OF PYTHON JHU Physics & Astronomy Python Workshop 2017 Lecturer: Mubdi Rahman HOW IS THIS WORKSHOP GOING TO WORK? We will be going over all the basics you need to get started and get productive
More informationCSE : Python Programming
CSE 399-004: Python Programming Lecture 2: Data, Classes, and Modules January 22, 2007 http://www.seas.upenn.edu/~cse39904/ Administrative things Teaching assistant Brian Summa (bsumma @ seas.upenn.edu)
More informationL435/L555. Dept. of Linguistics, Indiana University Fall 2016
for : for : L435/L555 Dept. of, Indiana University Fall 2016 1 / 12 What is? for : Decent definition from wikipedia: Computer programming... is a process that leads from an original formulation of a computing
More informationChapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines.
Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of
More informationIntroduction to Computer Programming CSCI-UA 2. Review Midterm Exam 1
Review Midterm Exam 1 Review Midterm Exam 1 Exam on Monday, October 7 Data Types and Variables = Data Types and Variables Basic Data Types Integers Floating Point Numbers Strings Data Types and Variables
More information06/11/2014. Subjects. CS Applied Robotics Lab Gerardo Carmona :: makeroboticsprojects.com June / ) Beginning with Python
CS95003 - Applied Robotics Lab Gerardo Carmona :: makeroboticsprojects.com June / 2014 Subjects 1) Beginning with Python 2) Variables 3) Strings 4) Basic arithmetic operators 5) Flow control 6) Comparison
More informationPYTHON FOR KIDS A Pl ayfu l I ntrodu ctio n to Prog r am m i ng J a s o n R. B r i g g s
PYTHON FO R K I D S A P l ay f u l I n t r o d u c t i o n to P r o g r a m m i n g Jason R. Briggs Index Symbols and Numbers + (addition operator), 17 \ (backslash) to separate lines of code, 235 in strings,
More informationCS 1110 SPRING 2016: GETTING STARTED (Jan 27-28) First Name: Last Name: NetID:
CS 1110 SPRING 2016: GETTING STARTED (Jan 27-28) http://www.cs.cornell.edu/courses/cs1110/2016sp/labs/lab01/lab01.pdf First Name: Last Name: NetID: Goals. Learning a computer language is a lot like learning
More informationCollections. Lists, Tuples, Sets, Dictionaries
Collections Lists, Tuples, Sets, Dictionaries Homework notes Homework 1 grades on canvas People mostly lost points for not reading the document carefully Didn t play again Didn t use Y/N for playing again
More informationStarting. Read: Chapter 1, Appendix B from textbook.
Read: Chapter 1, Appendix B from textbook. Starting There are two ways to run your Python program using the interpreter 1 : from the command line or by using IDLE (which also comes with a text editor;
More informationENGR 102 Engineering Lab I - Computation
ENGR 102 Engineering Lab I - Computation Learning Objectives by Week 1 ENGR 102 Engineering Lab I Computation 2 Credits 2. Introduction to the design and development of computer applications for engineers;
More informationData Structures (list, dictionary, tuples, sets, strings)
Data Structures (list, dictionary, tuples, sets, strings) Lists are enclosed in brackets: l = [1, 2, "a"] (access by index, is mutable sequence) Tuples are enclosed in parentheses: t = (1, 2, "a") (access
More informationIntroduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines
Introduction to UNIX Logging in Basic system architecture Getting help Intro to shell (tcsh) Basic UNIX File Maintenance Intro to emacs I/O Redirection Shell scripts Logging in most systems have graphical
More information15-110: Principles of Computing, Spring 2018
15-110: Principles of Computing, Spring 2018 Problem Set 5 (PS5) Due: Friday, February 23 by 2:30PM via Gradescope Hand-in HANDIN INSTRUCTIONS Download a copy of this PDF file. You have two ways to fill
More informationCS61A Lecture 15. Amir Kamil UC Berkeley February 25, 2013
CS61A Lecture 15 Amir Kamil UC Berkeley February 25, 2013 Announcements HW5 due on Wednesday Trends project out Partners are required; find one in lab or on Piazza Will not work in IDLE New bug submission
More informationCS 112: Intro to Comp Prog
CS 112: Intro to Comp Prog Importing modules Branching Loops Program Planning Arithmetic Program Lab Assignment #2 Upcoming Assignment #1 Solution CODE: # lab1.py # Student Name: John Noname # Assignment:
More informationOverview. - General Data Types - Categories of Words. - Define Before Use. - The Three S s. - End of Statement - My First Program
Overview - General Data Types - Categories of Words - The Three S s - Define Before Use - End of Statement - My First Program a description of data, defining a set of valid values and operations List of
More informationAccelerating Information Technology Innovation
Accelerating Information Technology Innovation http://aiti.mit.edu Cali, Colombia Summer 2012 Lesson 1 Introduction to Python Agenda What is Python? and Why Python? Basic Syntax Strings User Input Useful
More informationComputers and Computation. The Modern Computer. The Operating System. The Operating System
The Modern Computer Computers and Computation What is a computer? A machine that manipulates data according to instructions. Despite their apparent complexity, at the lowest level computers perform simple
More informationCS61A Lecture 16. Amir Kamil UC Berkeley February 27, 2013
CS61A Lecture 16 Amir Kamil UC Berkeley February 27, 2013 Announcements HW5 due tonight Trends project due on Tuesday Partners are required; find one in lab or on Piazza Will not work in IDLE New bug submission
More informationIntroduction to Python! Lecture 2
.. Introduction to Python Lecture 2 Summary Summary: Lists Sets Tuples Variables while loop for loop Functions Names and values Passing parameters to functions Lists Characteristics of the Python lists
More informationOperating System Interaction via bash
Operating System Interaction via bash bash, or the Bourne-Again Shell, is a popular operating system shell that is used by many platforms bash uses the command line interaction style generally accepted
More informationIntroduction to Python
Introduction to Python Reading assignment: Perkovic text, Ch. 1 and 2.1-2.5 Python Python is an interactive language. Java or C++: compile, run Also, a main function or method Python: type expressions
More informationTeaching London Computing
Teaching London Computing A Level Computer Science Topic 3: Advanced Programming in Python William Marsh School of Electronic Engineering and Computer Science Queen Mary University of London Aims Further
More informationOverview of the UNIX File System. Navigating and Viewing Directories
Overview of the UNIX File System Navigating and Viewing Directories Copyright 2006 Stewart Weiss The UNIX file system The most distinguishing characteristic of the UNIX file system is the nature of its
More informationCS61A Lecture 16. Amir Kamil UC Berkeley February 27, 2013
CS61A Lecture 16 Amir Kamil UC Berkeley February 27, 2013 Announcements HW5 due tonight Trends project due on Tuesday Partners are required; find one in lab or on Piazza Will not work in IDLE New bug submission
More informationDownload Python from Any version will do for this class
Let s Start Python Let s Start! Download Python from www.python.org Any version will do for this class By and large they are all mutually compatible Recommended version: 2.1.1 or 2.2 Oldest version still
More informationCS Programming Languages: Python
CS 3101-1 - Programming Languages: Python Lecture 5: Exceptions / Daniel Bauer (bauer@cs.columbia.edu) October 08 2014 Daniel Bauer CS3101-1 Python - 05 - Exceptions / 1/35 Contents Exceptions Daniel Bauer
More informationCS1110 Lab 1 (Jan 27-28, 2015)
CS1110 Lab 1 (Jan 27-28, 2015) First Name: Last Name: NetID: Completing this lab assignment is very important and you must have a CS 1110 course consultant tell CMS that you did the work. (Correctness
More informationIntroduction to Python
Introduction to Python Jon Kerr Nilsen, Dmytro Karpenko Research Infrastructure Services Group, Department for Research Computing, USIT, UiO Why Python Clean and easy-to-understand syntax alldata = cpickle.load(open(filename1,
More informationUniversity of Washington CSE 140 Introduction to Data Programming Winter Midterm exam. February 6, 2013
University of Washington CSE 140 Introduction to Data Programming Winter 2013 Midterm exam February 6, 2013 Name: Solutions UW Net ID (username): This exam is closed book, closed notes. You have 50 minutes
More informationCOMP519 Web Programming Lecture 17: Python (Part 1) Handouts
COMP519 Web Programming Lecture 17: Python (Part 1) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool Contents
More informationFunctions Defining Calling (invoking) Parameters Returned values
As you arrive: 1. Start up your computer and plug it in 2. Log into Angel and go to CSSE 120 3. Do the Attendance Widget the PIN is on the board 4. Go to the course Schedule Page From your bookmark, or
More informationPlay with Python: An intro to Data Science
Play with Python: An intro to Data Science Ignacio Larrú Instituto de Empresa Who am I? Passionate about Technology From Iphone apps to algorithmic programming I love innovative technology Former Entrepreneur:
More information[CHAPTER] 1 INTRODUCTION 1
FM_TOC C7817 47493 1/28/11 9:29 AM Page iii Table of Contents [CHAPTER] 1 INTRODUCTION 1 1.1 Two Fundamental Ideas of Computer Science: Algorithms and Information Processing...2 1.1.1 Algorithms...2 1.1.2
More informationPHP. Interactive Web Systems
PHP Interactive Web Systems PHP PHP is an open-source server side scripting language. PHP stands for PHP: Hypertext Preprocessor One of the most popular server side languages Second most popular on GitHub
More informationBeyond Blocks: Python Session #1
Beyond Blocks: Session #1 CS10 Spring 2013 Thursday, April 30, 2013 Michael Ball Beyond Blocks : : Session #1 by Michael Ball adapted from Glenn Sugden is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike
More informationCSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80
CSE 303 Lecture 2 Introduction to bash shell read Linux Pocket Guide pp. 37-46, 58-59, 60, 65-70, 71-72, 77-80 slides created by Marty Stepp http://www.cs.washington.edu/303/ 1 Unix file system structure
More informationCSC 148 Lecture 3. Dynamic Typing, Scoping, and Namespaces. Recursion
CSC 148 Lecture 3 Dynamic Typing, Scoping, and Namespaces Recursion Announcements Python Ramp Up Session Monday June 1st, 1 5pm. BA3195 This will be a more detailed introduction to the Python language
More informationData type built into Python. Dictionaries are sometimes found in other languages as associative memories or associative arrays.
NETB 329 Lecture 4 Data Structures in Python Dictionaries Data type built into Python. Dictionaries are sometimes found in other languages as associative memories or associative arrays. 1 of 70 Unlike
More informationPointers (continued), arrays and strings
Pointers (continued), arrays and strings 1 Last week We have seen pointers, e.g. of type char *p with the operators * and & These are tricky to understand, unless you draw pictures 2 Pointer arithmetic
More information