mirror of
https://github.com/kennethreitz/dive-into-python3.git
synced 2026-06-05 15:00:18 +00:00
asterisms
This commit is contained in:
@@ -20,6 +20,8 @@ body{counter-reset:h1 3}
|
||||
<h2 id=divingin>Diving In</h2>
|
||||
<p class=f>This chapter will teach you about list comprehensions, dictionary comprehensions, and set comprehensions: three related concepts centered around one very powerful technique. But first, I want to take a little detour into two modules that will help you navigate your local file system.
|
||||
|
||||
<p class=a>⁂
|
||||
|
||||
<h2 id=os>Working With Files And Directories</h2>
|
||||
|
||||
<p>Python 3 comes with a module called <code>os</code>, which stands for “operating system.” The <a href=http://docs.python.org/3.1/library/os.html><code>os</code> module</a> contains a plethora of functions to get information on — and in some cases, to manipulate — local directories, files, processes, and environment variables. Python does its best to offer a unified <abbr>API</abbr> across <a href=installing-python.html>all supported operating systems</a> so your programs can run on any computer with as little platform-specific code as possible.
|
||||
@@ -191,6 +193,8 @@ body{counter-reset:h1 3}
|
||||
<samp class=p>>>> </samp><kbd class=pp>print(os.path.realpath('feed.xml'))</kbd>
|
||||
<samp class=pp>c:\Users\pilgrim\diveintopython3\examples\feed.xml</samp></pre>
|
||||
|
||||
<p class=a>⁂
|
||||
|
||||
<h2 id=listcomprehension>List Comprehensions</h2>
|
||||
|
||||
<aside>You can use any Python expression in a list comprehension.</aside>
|
||||
|
||||
Reference in New Issue
Block a user